Hi,
I have a problem with elasticsearch boost. I use Node Js API, and my query looks something like this:
query: {
bool: {
should: [
{ match: {
"name": {
query: args.text,
boost: 10
}}
},
{ match: {
"tags": {
query: args.text,
boost: 8
}}
}
]
}
};
and consider I have these docs ( I actually have a lot of docs, and most of them has jumps in the name):
docs: [{name: "fox jumps", tag: "animal"}, {name: "monkey jumps" tag: "jumps"];
For some reason, if I search for: "fox brown jumps" I got this in the rank:
- monkey jumps
- fox jumps
In the explanation, it seems that when it gets "fox jumps" it matches "fox" (first match in name) and got a high score, but when it matches "jumps" (second match in name) it scores pretty low.
Meanwhile when it searches for "monkey jumps" it matches "jumps" (first match in name) and got a high score, and it matches "jumps" (first match in tags) it also got a high score.
Does anyone knows why that happens? I know that scoring is not just a sum of the boost, but I would assume that "fox jumps" should get score of 20 (or thereabouts) and "monkey jumps" should get a score of 18. Therefore, "fox jumps" should be ranked higher than "monkey jumps".
I can get around it by boosting the name a whole more, say I boost name to 100 and tags to 10. But I would like to get an explanation of how this should work if possible.