I am looking for cities from geonames db. A typical search string would be "San Francisco CA". I have documents in which there is a city and state field. I make a match query matching the search string with the city and state, then combine these matches with bool :
"query" : { "bool" : { "must" : { "match" : { "country" : { "query" : "San Francisco CA" } } }, "should" : { "match" : { "city" : { "query" : "San Francisco CA" } } } } }
I have these two documents in my db:
{"city" : "San Francisco", "state" : "CA"} {"city" : "San Marino", "state" : "San Marino"}
The problem is that the alignment of “san” with San Marino state ratings is much higher than the comparison of CA with the state of San Francisco, because there are many cities with a state “CA” and very small cities with a state “San Marino”.
I'm trying to disable IDF using constant_score , but this leads to another problem: matching San Francisco to San Francisco with San Francisco, where the two matches are the same, matches San Francisco California to San Marino "" where only one term matches. When a multi-thermal match request is rewritten into separate terms, is it possible for constant_score to execute each of the rewritten requests to get a score of 2 for San Francisco and score 1 for only San ,
elasticsearch
Beowulfenator
source share