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