New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
odd scoring behaviour / inconsistent scoring #3521
Comments
hey @lmenezes, I am afraid but this is the expected behavior. there is a lot going on in this boolean query construct that depends on a number of factors. the only guarantee here is that it will be the same score for all docs. Yet the eventual score and the query norm depend on your similarity, with a similarity that doesn not modify the query norm I guess it'd be 1.0 across the board. |
@s1monw that's the thing... i don't get a constant score for all documents. i do understand(also, don't care. not interested in the score for this case) that running the same query multiple times might result in different scores. but, for the same execution the documents should all score the same, right? if so, then there is something wrong here. |
I just wrote a tests for this and I actually get back scores for all docs taht are consistent. I might not understand your problem here. you run this query and two docs get different scores? |
i tried pretty hard myself to write an example that worked(got 2 documents with different scores) here and wasn't able to. i could not reproduce that into my staging environment, only on live. the difference between staging and live at the moment, is that staging is not getting updates and has no replicas(if this info might help). would setting explain -> true, and getting all the results help? its a pretty big response... |
@lmenezes any idea where the boost comes from that is shown in your response? |
you mean this: ConstantScore(:)^3 right? if so, no idea. actually i'm executing the query from a file, so i know its always the same. |
@lmenezes check your email |
If a static cached version of MatchAllDocsQuery is used through for instanst the `query_string` together with a boost like `*:*^2.0` the globally used version is modified since queries are not immutable and it's boost variable can change at any time. Holding on to queries that are modifiable is risky and should not be done in a global scope. This commit also adds tests for constant scores from `constant_score` query. Closes elastic#3521
this is more sneaky than I though... we are modifying a cached version of match all docs in the query parser... a fix is attached |
looks good. we currently fixed using a default boost != 1.0 for the matchall queries and will remove when updating to next version. |
FYI - this can be triggered from a user query via |
If a static cached version of MatchAllDocsQuery is used through for instanst the `query_string` together with a boost like `*:*^2.0` the globally used version is modified since queries are not immutable and it's boost variable can change at any time. Holding on to queries that are modifiable is risky and should not be done in a global scope. This commit also adds tests for constant scores from `constant_score` query. Closes #3521
great :) |
If a static cached version of MatchAllDocsQuery is used through for instanst the `query_string` together with a boost like `*:*^2.0` the globally used version is modified since queries are not immutable and it's boost variable can change at any time. Holding on to queries that are modifiable is risky and should not be done in a global scope. This commit also adds tests for constant scores from `constant_score` query. Closes elastic#3521
unfortunately i wasn't able to reproduce this in the usual way, but here is the case:
I have a query such as
to the terms filter, i pass a list of ids(anywhere between 1 and 200k unique ids).
when executing this query multiple times i get different results. so, investigating a little i traced it to the score not being constant sometimes(not what i expected at all).
i ran the same query a few times with explain set to true and getting only the last document, and here is what i got:
and then
so, here i would expect this query to ALWAYS have the same score, and also, that every document scores exactly the same.
it could even seem ok if the score wasnt constant across requests, but not really that documents score differently.
** hope thats clear enough... but let me know if you need more info, or even the complete output for the explain(its pretty big)
The text was updated successfully, but these errors were encountered: