Hello,
I have a list of a few thousand categories and I am having trouble prioritizing exact/like matches to the top. For example, I will search for "Movie Theater" and be returned a list of items from my index in this order:
Performing Arts Theater
Dinner Theater
Movie Studio
...
Movie Theater
How can I have the exact result returned first and why isn't it happening already?
curl -XPUT http://localhost:9200/categories -d '{
"settings": {
"analysis": {
"filter": {
"category_synonym_filter": {
"type": "synonym",
"synonyms": ["bike,bicycle", "bar,pub"]
}
},
"analyzer": {
"lower_synonyms": {
"tokenizer": "standard",
"filter": ["lowercase", "category_synonym_filter"]
}
}
}
}
}'
curl -XPUT http://localhost:9200/categories/category/_mapping -d '{
"category" : {
"properties" : {
"category_description" : {
"type" : "string",
"analyzer": "lower_synonyms"
},
"type" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}'
{size=100, query={bool={filter={bool={must=[{query_string={query=movie theater* OR movie theater OR movie theater~1, fields=[category_description]}}]}}, must={match_all={}}}}, from=0}
Thank you in advance!