-
Notifications
You must be signed in to change notification settings - Fork 25k
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
_source not returned in "explain": true with certain queries #31000
Comments
Pinging @elastic/es-search-aggs |
I finally got to doing some digging on this one. Indeed, it is a very peculiar bug, and I am not sure yet how to solve it, but I can now explain how it happens: this only happens when explaining a script score function that's part of a nested query inside a rescore section. When trying to explain the score function, we run the script which ends up calling LeafSearchLookup#setDocument which calls SourceLookup#setSegmentAndDocument that ends up zeroing the source that was previously loaded, as we are going through a different docId compared to the previous run (nested doc rather than parent doc). |
@javanna do you have a suggestion how to make it still working? Is there some hack? |
@jtibshirani great, thanks for the answer. As a workaround i thought about making a subsequent request after the explain request, just to retrieve the source of the documents using the Ids query. But this would be a hack, so ill better wait for the refactor #60179 |
The `SourceLookup` class provides access to the _source for a particular document, specified through `SourceLookup#setSegmentAndDocument`. Previously the search context contained a single `SourceLookup` that was shared between different fetch subphases. It was hard to reason about its state: is `SourceLookup` set to the expected document? Is the _source already loaded and available? Instead of using a global source lookup, the fetch hit context now provides access to a lookup that is set to load from the hit document. This refactor closes #31000, since the same `SourceLookup` is no longer shared between the 'fetch _source phase' and script execution.
The `SourceLookup` class provides access to the _source for a particular document, specified through `SourceLookup#setSegmentAndDocument`. Previously the search context contained a single `SourceLookup` that was shared between different fetch subphases. It was hard to reason about its state: is `SourceLookup` set to the expected document? Is the _source already loaded and available? Instead of using a global source lookup, the fetch hit context now provides access to a lookup that is set to load from the hit document. This refactor closes #31000, since the same `SourceLookup` is no longer shared between the 'fetch _source phase' and script execution.
Elasticsearch version: 5.9.6 & 6.2.4
Plugins installed: []
JVM version: independent
OS version: independent
Description of the problem including expected versus actual behavior:
The
_source
is not being returned for hits whenexplain
is set totrue
for a specific set of queries. The conditions for_source
to be missing appear to be:Steps to reproduce:
The text was updated successfully, but these errors were encountered: