-
Notifications
You must be signed in to change notification settings - Fork 25.6k
For constant_keyword, make sure exists query handles missing values. #55757
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
Conversation
It's possible for a constant_keyword to have a 'null' value before any documents are seen that contain a value for the field. In this case, no documents have a value for the field, and 'exists' queries should return no documents.
|
Pinging @elastic/es-search (:Search/Search) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in itself looks good to me.
Just a short clarifying question/remark: with this behaviour, the moment the first document is indexed that sets the constant fields value, all previously indexed documents will also show up in an "exists" query for that field. This might be suprising for some users, so maybe a short remark in the docs is in order? I also wonder if the current behaviour (always returning all docs regardless of a set value) isn't less suprising. The act of adding a "constant" field to the mapping by the user might be considered as meaning "this field exists on all documents across the board"? Would that also make sense to you? I'm torn which behaviour I would prefer as a user, maybe someone else should also weigh in on this.
|
Thanks @cbuescher for reviewing! I'd also be happy if others weighed in. My understanding of exists queries is that they check if a document contains a value for a field. If the value is missing or null, it won't be returned. I think of an exists query as being semantically equivalent to the wildcard query |
jimczi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, should we add a small note in the docs to explain this behavior ?
cbuescher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtibshirani thanks for your thought, just wanted to run these thoughts past you.
…55757) It's possible for a constant_keyword to have a 'null' value before any documents are seen that contain a value for the field. In this case, no documents have a value for the field, and 'exists' queries should return no documents.
…55757) It's possible for a constant_keyword to have a 'null' value before any documents are seen that contain a value for the field. In this case, no documents have a value for the field, and 'exists' queries should return no documents.
It's possible for a constant_keyword to have a 'null' value before any documents
are seen that contain a value for the field. In this case, no documents have a
value for the field, and 'exists' queries should return no documents.
Fixes #53545.