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, say, 1.
After reading the docs, I understand the OR I am trying to implement can be done with a should clause inside a bool like so:
{
"query": {
"bool": {
"should": [
{"match": {"firstField": "queryString"}},
{"term": {"secondField": 1}}
]
}
}
}
The results however show that secondField contributes far less (approximately 4 times) to the result than firstField does since their scoring algorithms are different. firstField effectively eclipses secondField, even though I want them to weigh the same on the final score.
My question is twofold:
- is it even recommended to have a
matchinside ashould(or any otherboolsub-clause) since the result is non-boolean? - how can I make two clauses of different natures (in this case
matchandterm) weigh the same on the final score (have the same scoring span)?