# Elastic search to store and find names

**URL:** https://discuss.elastic.co/t/elastic-search-to-store-and-find-names/12207
**Category:** Elasticsearch
**Created:** [May 31, 2013, 1:34pm UTC](https://discuss.elastic.co/t/elastic-search-to-store-and-find-names/12207 "2013-05-31T13:34:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Max\_Max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max_max/32/1813_2.png) [@Max\_Max](https://discuss.elastic.co/u/Max_Max)
#### Post date: [May 31, 2013, 1:34pm UTC](https://discuss.elastic.co/t/elastic-search-to-store-and-find-names/12207/1 "2013-05-31T13:34:43Z")

</div>

Scanario:

Suppose I have index with type 'names'

type names has only single field of type string in the from "first\_name  
last\_name"

Now I want to search 'names' type to get suggestions when user typed  
something in the input, user could type not whole word and user could type  
some word with mistyping (and not wole word)

So I know how to get right result when user type part of the name  
(correctly) "{part\_of\_the\_name}\*" or when he types whole word with the  
mistyping "{whole\_name\_with\_some\_error}~0.7" But not both.

For example

# types : names

## val

mikkey mouse  
hommer simpson  
max pain

User type - [ma], he should get [mikkey mouse, max pain]  
User type - [mix], he should get [max pain]

So I decided to use ngram analizer

{  
"settings": {  
"analysis": {  
"filter": {  
"name\_ngrams": {  
"side": "front",  
"max\_gram": 20,  
"min\_gram": 2,  
"type": "edgeNGram"  
}  
},  
"analyzer": {  
"partial\_name": {  
"filter": [  
"standard",  
"lowercase",  
"asciifolding",  
"name\_ngrams"  
],  
"type": "custom",  
"tokenizer": "standard"  
}  
}  
}  
}  
}

and mapping

{  
"names": {  
"properties": {  
"val": {  
"type": "string",  
"analyzer": "partial\_name"  
}  
}  
}  
}

But still can't get desired results.

Can somebody help?

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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: [July 6, 2017, 2:33am UTC](https://discuss.elastic.co/t/elastic-search-to-store-and-find-names/12207/2 "2017-07-06T02:33:37Z")

</div>


