7

Railsアプリでelasticsearch-rails gemを使用して、Elasticsearchとの統合を簡素化しています。音声分析プラグインを使用しようとしているので、インデックス用にカスタム アナライザーとカスタム フィルターを定義する必要があります。

soundex音声フィルターを使用してカスタム分析を実行するために、このコードを試しましたが、例外メッセージで失敗しました:

[!!!] インデックス作成時のエラー: Elasticsearch::Transport::Transport::Errors::BadRequest [400] {"error":"MapperParsingException[mapping [call_sentence]]; ネスト: MapperParsingException[Analyzer [{tokenizer= standard, filter=[standard, lowercase, metaphoner]}] not found for field [ふりがな]]; ","status":400}

# Set up index configuration and mapping
#
settings index: { number_of_shards: 1, number_of_replicas: 0 } do
  mapping do
    indexes :text, type: 'multi_field' do
      indexes :processed, analyzer: 'snowball'
      indexes :phone, {analyzer: {
        tokenizer: "standard",
        filter: ["standard", "lowercase", "metaphoner"]
      }, filter: {
        metaphoner: {
            type: "phonetic",
            encoder: "soundex",
            replace: false
        }
      }}
      indexes :raw, analyzer: 'keyword'
    end
  end
end
4

2 に答える 2

2

よし、elasticsearch.yml 構成を変更して、音声分析を含めました

#################################### Index ####################################
index: 
  analysis: 
    analyzer: 
      phonetic_analyzer: 
        tokenizer: standard
        filter: [metaphoner]
    filter: 
      metaphoner: 
        type: phonetic
        encoder: doublemetaphone
        replace: true
于 2014-08-25T01:32:20.360 に答える