I use elasticsearch-rails gem in my Rails application to simplify integration with Elasticsearch. I am trying to use the phonetic analysis plugin , so I need to define my own analyzer and a custom filter for my index.
I tried this part of the code to do user analysis using a phonetic sound filter, but with an error with an exception message:
[!!!] Error creating index: Elasticsearch :: Transport :: Transport :: Errors :: BadRequest [400] {"error": "MapperParsingException [mapping [call_sentence]]; inested: MapperParsingException [Analyzer [{tokenizer = standard , filter = [standard, lowercase, metaphoner]}] not found for field [phonetic]]; "," 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
ruby-on-rails elasticsearch elasticsearch-plugin
badawym
source share