# Not getting exact completions as expected

**URL:** <https://discuss.elastic.co/t/not-getting-exact-completions-as-expected/180372>\
**Category:** Elasticsearch\
**Created:** [May 9, 2019, 1:17pm UTC](https://discuss.elastic.co/t/not-getting-exact-completions-as-expected/180372 "2019-05-09T13:17:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarunnar](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tarunnar](https://discuss.elastic.co/u/tarunnar)\
**Post date:** [May 9, 2019, 1:17pm UTC](https://discuss.elastic.co/t/not-getting-exact-completions-as-expected/180372/1 "2019-05-09T13:17:47Z")

</div>

I have defined my mapping for index autocomplete as  
`{ "mappings": { "panels": { "properties": { "dealer": { "type": "completion" }, "county": { "type": "completion", "contexts": [{ "name": "dealername", "type": "category", "path": "dealername" }, { "name": "statename", "type": "category", "path": "statename" }] }, "state": { "type": "completion", "contexts": [{ "name": "dealername", "type": "category", "path": "dealername" }] }, "dealername":{ "type": "keyword" }, "statename":{ "type": "keyword" }, "countyname":{ "type": "keyword" }, "meid": { "type": "text" } } } } }`  
When I am trying to fetch completion suggestion on field dealer as dealer2 I am getting  
`curl -X POST "########:9200/autocomplete/_search?pretty" -H 'Content-Type: application/json' -d' { "suggest": { "state_suggestion_for_dealer" : { "prefix" : "dealer2", "completion" : { "field" : "dealer", "size": 10 } } } } '`

I am getting results as  
`{ "text" : "dealer3", "_index" : "autocomplete", "_type" : "panels", "_id" : "#########", "_score" : 1.0, "_source" : { "dealer" : { "input" : ["dealer3"] }, "state" : { "input" : ["Virginia"], "contexts" : { "dealername" : ["dealer3"] } }, "county" : { "input" : ["Park"], "contexts" : { "dealername" : ["dealer3"], "statename" : ["Virginia"] } }, "dealername" : "dealer3", "statename" : "Virginia", "countyname" : "Park", "meid" : "###########" } } As in the curl request I had specified delaer2 i should not get dealer3 results in suggestion .`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 6, 2019, 1:23pm UTC](https://discuss.elastic.co/t/not-getting-exact-completions-as-expected/180372/2 "2019-06-06T13:23:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
