My completion analyzer not working...mapping is like this...
PUT music
{
"settings":{
"analysis":{
"analyzer":{
"completion_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "keyword",
"min_gram": 1,
"max_gram": 20,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
"mappings":{
"song":{
"properties":{
"suggest" : {
"type" : "completion",
"analyzer": "completion_analyzer"
}
}
}
}
}
After that I index one doc like this..
PUT music/song/1?refresh
{
"suggest" : {
"input": [ "sony",
"xperia",
"m2",
"3d",
"back",
"covers",
"xepby",
"xpfuson" ]
}
}
Then I did one query...
POST music/_search?pretty
{
"suggest": {
"song-suggest" : {
"prefix" : "x",
"completion" : {
"field" : "suggest",
"size" : 5
}
}
}
}
So there is three words of x name...but result showing only one...even I applied ngram analyzer..its not working...
Result..
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0,
"hits": []
},
"suggest": {
"song-suggest": [
{
"text": "x",
"offset": 0,
"length": 1,
"options": [
{
"text": "xepby",
"_index": "music",
"_type": "song",
"_id": "1",
"_score": 1,
"_source": {
"suggest": {
"input": [
"sony",
"xperia",
"m2",
"3d",
"back",
"covers",
"xepby",
"xpfuson"
]
}
}
}
]
}
]
}
}
Why I am not getting other x also as a suggestion...
Thanks