# Spell check suggestion

**URL:** <https://discuss.elastic.co/t/spell-check-suggestion/84397>\
**Category:** Elasticsearch\
**Created:** [May 3, 2017, 10:25am UTC](https://discuss.elastic.co/t/spell-check-suggestion/84397 "2017-05-03T10:25:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek5678](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@abhishek5678](https://discuss.elastic.co/u/abhishek5678)\
**Post date:** [May 3, 2017, 10:25am UTC](https://discuss.elastic.co/t/spell-check-suggestion/84397/1 "2017-05-03T10:25:52Z")

</div>

Hi Everyone,  
i want to perform spell check suggestion with my data.I tried hard but i'm not able to get spell check suggestion.if anybody knows about that then please help me to resolve this [problem.so](http://problem.so) tell me what is putting inside the mapping and the query to get the spell check suggestion.Let suppose i am putting name as Iorn means wrong spelling will be putting then automatic suggest me to correct word.I am sending my Index,mapping,data and query

1. Index:

PUT /test\_word20  
{  
"settings": {  
"number\_of\_shards": 1,  
"analysis": {  
"filter": {  
"autocomplete\_filter": {  
"type": "edge\_ngram",  
"min\_gram": 1,  
"max\_gram": 20  
}  
},  
"analyzer": {  
"autocomplete": {  
"type": "custom",  
"tokenizer": "standard",  
"filter": [  
"lowercase",  
"autocomplete\_filter"  
]  
}  
}  
}  
}  
}

1. MAPPING:

PUT /test\_word20/\_mapping/my\_type  
{  
"properties": {  
"name": {  
"type": "string",  
"analyzer": "autocomplete"  
},  
"depth":{  
"type":"long"  
},  
"children": {  
"type": "nested",  
"properties": {  
"name": {  
"type": "string",  
"analyzer": "autocomplete"  
},  
"depth":{  
"type":"long"  
},  
"children": {  
"type": "nested",  
"properties": {  
"code": { "type": "string" },  
"name": {  
"type": "string",  
"analyzer": "autocomplete"  
},  
"depth":{  
"type":"long"  
},  
"children": {  
"type": "nested",  
"properties": {  
"code": { "type": "string" },  
"name": {  
"type": "string",  
"analyzer": "autocomplete"  
},  
"depth":{  
"type":"long"  
}  
}  
}  
}  
}  
}  
}  
}  
}

1. DATA:

POST /test\_word20/my\_type/1  
{  
"name": "Diseases of the blood and blood-forming organs and certain disorders involving the immune mechanism (D50-D89)",  
"depth": 1,  
"children": [{  
"name": "Nutritional anemias (D50-D53)",  
"depth": 2,  
"children": [{  
"code": "D50",  
"name": "Iron deficiency anemia",  
"depth": 3,  
"children": [{  
"code": "D50.0",  
"name": "Iron deficiency anemia secondary to blood loss (chronic)",  
"depth": 4  
}, {  
"code": "D50.1",  
"name": "Sideropenic dysphagia",  
"depth": 4  
}, {  
"code": "D50.8",  
"name": "Other iron deficiency anemias",  
"depth": 4  
}, {  
"code": "D50.9",  
"name": "Iron deficiency anemia, unspecified",  
"depth": 4  
}]  
}]  
}]  
}

1. QUERY:

GET /test\_word20/my\_type/\_search  
{  
"\_source": false,  
"query": {  
"nested": {  
"path": "children.children.children",  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"[children.children.children.name](http://children.children.children.name)": {  
"query": "Iron",  
"analyzer": "standard"  
}  
}  
}  
]  
}  
},  
"inner\_hits": {  
"\_source": {  
"excludes":["name"]  
}  
}

```
    }
}

```

}

---

<div class="post-metadata">

**Author:** ![Abhilash\_Bolla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhilash_bolla/32/26840_2.png) [@Abhilash\_Bolla](https://discuss.elastic.co/u/Abhilash_Bolla)\
**Post date:** [May 4, 2017, 10:50am UTC](https://discuss.elastic.co/t/spell-check-suggestion/84397/2 "2017-05-04T10:50:56Z")

</div>

You may try using the phrase suggester for your purpose. Its also gives a flexibility to couple it with a query using the **collate** functionality.

Please [refer here](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-phrase.html)

---

<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 1, 2017, 11:01am UTC](https://discuss.elastic.co/t/spell-check-suggestion/84397/3 "2017-06-01T11:01:58Z")

</div>

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