i have data below
- coconut oil
- liquid coconut oil
- Nutiva Coconut Oil
- Kelapo Coconut Oil
- coconut oil spray
when i searching "coconut oil", i want to the first result is "coconut oil"
but now "liquid coconut oil" have hight score. and result is wrong.
i don't know why.
anyone can help me. thank you so much.
this is my query
GET collection/_search
{
"query": {
"match": {
"ingredient": {
"query": "coconut oil",
"operator": "or"
}
}
},
"sort": [
{
"_score": {
"order": "desc"
}
}
]
}
this is my mapping
PUT collection
{
"settings": {
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 3,
"max_gram": 7
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
},
"mappings": {
"data": {
"properties": {
"id" : { "type" : "integer"},
"ingredient": {
"type": "text",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
}
}
}
}