Hi,
I am building a search with edge ngram.
Here is my mapping:
PUT xyz
{
"settings": {
"analysis": {
"filter": {
"autocomplete": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 15,
"token_chars": [
"letter",
"digit"
]
}
},
"analyzer": {
"autocomplete_search": {
"tokenizer": "standard",
"type": "custom",
"filter": [ "autocomplete","lowercase" ]
}
}
}
},
"mappings" : {
"properties" : {
"codevalue" : {
"type" : "text",
"analyzer": "autocomplete_search"
}
}
}
}
My search query is
GET xyz/_search
{ "_source": "codevalue",
"query":{
"match": {
"codevalue": {
"query": "CP 12"
}
}
}
}
Result is:
{"codevalue" : "CP 12"},
{"codevalue" : "DP 12"},
{"codevalue" : "CP 11315 : Part 12"},
{"codevalue" : "CP 11777 : Part 12"},
{"codevalue" : "CP 13557 : Part 12"},
{"codevalue" : "CP 228 : Part 12"},
{"codevalue" : "CP 3025 : Part 12"},
{"codevalue" : "CP 5347 : Part 12"},
{"codevalue" : "CP 13109 : Part 12"},
{"codevalue" : "CP 3842 : Part 12"}
I want to get like
"codevalue": "CP 12"
"codevalue": "CP 125"
"codevalue": "CP 12...."
......continued
Thanks