Completion analyzer

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

as all the suggestions are in one document, only this document is being returned, with one suggestions. You could control which one is returned by configured a weight.

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