I have implemented onlt one word combine auto suggestion in ES. But i couldn't implement three word combine auto search as I mention below screenshot.
ES record output
{ "took": 7, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 4, "max_score": 1, "hits": [ { "_index": "test_index", "_type": "test_type", "_id": "4", "_score": 1, "_source": { "title": "Apple i Phone 4S", "description": "some description" } }, { "_index": "test_index", "_type": "test_type", "_id": "2", "_score": 1, "_source": { "title": "Apple iPhone I Phone 5 Original", "description": "some description" } }, { "_index": "test_index", "_type": "test_type", "_id": "1", "_score": 1, "_source": { "title": "Apple iPhone 6+", "description": "some description" } }, { "_index": "test_index", "_type": "test_type", "_id": "3", "_score": 1, "_source": { "title": "Apple iMac 21.5/2.8GHz/i5/8GB 2016", "description": "some description" } } ] }, "aggregations": { "autocomplete": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "key": "apple", "doc_count": 4 } ] } } }
here my ES query.
PUT test_index
{ "settings": { "index": { "analysis": { "filter": { "stemmer": { "type": "stemmer", "language": "english" }, "stopwords": { "type": "stop", "stopwords": [ "_english_" ] } }, "analyzer": { "autocomplete": { "filter": [ "lowercase" ], "char_filter": [ "html_strip" ], "type": "custom", "tokenizer": "standard" }, "default": { "filter": [ "lowercase", "stopwords", "stemmer" ], "char_filter": [ "html_strip" ], "type": "custom", "tokenizer": "standard" } } } } }, "mappings": { "test_type": { "properties": { "autocomplete": { "type": "text", "analyzer": "autocomplete", "fielddata": true }, "description": { "type": "text" }, "title": { "type": "text", "copy_to": [ "autocomplete" ] } } } } }
ES Document
POST /test_index/test_type/1 { "title": "Apple iPhone 6+", "description": "some description" } POST /test_index/test_type/2 { "title": "Apple iPhone I Phone 5 Original", "description": "some description" } POST /test_index/test_type/3 { "title": "Apple iMac 21.5/2.8GHz/i5/8GB 2016", "description": "some description" } POST /test_index/test_type/4 { "title": "Apple i Phone 4S", "description": "some description" } POST /test_index/test_type/5 { "title": "Amazon kindle", "description": "some description" } POST /test_index/test_type/7 { "title": "Apploo i Phone 4S", "description": "some description" }