I'd like to search items that either have firstField
(mapped as text) similar to a query string or secondField
(mapped as an integer) equal to 1.
After reading the docs, I understand I should be using bool
with should
(as noted here):
{
"query": {
"bool": {
"should": [
{"match": {"firstField": "queryString"}},
{"term": {"secondField": 1}}
]
}
}
}
The results however show that secondField
contributes far less to the result than firstField
does since their scoring algorithms produce different scales.
I am considering artifically boost
ing the secondField
(though I am guessing this would only work in some cases) or normalizing firstField
to somehow represent a percentage instead of an arbitrary score.
Is there a proper way to give each field the same weight?
Note: I am using ES 7.x
.