Elastic search to store and find names

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.
For more options, visit https://groups.google.com/groups/opt_out.