elasticsearch
Mappings on filed Elastic Search
I am using elastic search for autocompletion and also to correct spelling mistakes.I have this mapping for my field(for auto-completion). **Mapping:** "name": { "type": "text", "analyzer": "autocomplete" } Now i want to implement phrase suggester on this field.When i use this it is giving wrong result.Thats because of existing mapping i think. **POST XYZ/_search** { "suggest": { "text": "ipone 16", "simple_phrase": { "phrase": { "field": "name", "highlight": { "pre_tag": "<em>", "post_tag": "</em>" } } } } } **Results:** "options": [ { "text": "i ip ipo iphon iphone 1 16", "highlighted": "i ip ipo <em>iphon iphone</em> 1 16", "score": 1.6111489e-8 }, { "text": "i ip ipo iphon iphon 1 16", "highlighted": "i ip ipo <em>iphon iphon</em> 1 16", "score": 1.4219211e-8 }, { "text": "i ip ipo ipho iphone 1 16", "highlighted": "i ip ipo <em>ipho iphone</em> 1 16", "score": 1.3510152e-8 }, { "text": "i ip ipo ipho iphon 1 16", "highlighted": "i ip ipo <em>ipho iphon</em> 1 16", "score": 1.1923397e-8 }, { "text": "i ip ipo iron iphone 1 16", "highlighted": "i ip ipo <em>iron iphone</em> 1 16", "score": 6.443544e-9 } ] **From the document i should use this for phrase suggester.** "mappings": { "test": { "properties": { "title": { "type": "text", "fields": { "trigram": { "type": "text", "analyzer": "trigram" }, "reverse": { "type": "text", "analyzer": "reverse" } } } } **How can i use two different mapping on same filed?**
As your results are not tokenized properly the problem could be from your aurocomplete analyzer. please provide your _settings to see the defination for your analyzers. Do Your query on name.trigram. After solving this problem it's good to prune your result using collate
Related Links
How can I sort by a value of a “nested” Hash in Elasticsearch
Add custom field type to ElasticSearch
Issue with document type name containing special characters - elasticsearch
ElasticSearch ignoring sort when filtered
elastic search ngram special characters
ElasticSearch multi indexes effect on performance + Tire default config
Exact (not substring) matching in Elasticsearch
Is a geo_distance query with linestring or multipolygon geo type possible?
After indexing file how to extract properties of file such as:-file type,name etc. by elasticsearch
how to filter facet to show only specific terms
How to search using keyword analyzer on Elastic Search?
Only index certain fields from Wikipedia River
How do I setup a 1:N workflow with filters in Logstash?
boost the score relative to term location in field elasticsearch
Elasticsearch range query for string
is there a way to boost matches in long documents in elasticsearch