-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Don't compile script fields when size is 0 #31824
Comments
Pinging @elastic/es-search-aggs |
We discussed this in fix-it-thursday and decided this sounds like a good idea. Let's do it |
@Parth-Vader I think it would be this line, so that script fields are not compiled or added to the search context. Upon further thought, I also wonder whether this should be an error case? Otherwise part of the request is being silently ignored. |
Failing the request is another option indeed. I guess ignoring the script has by preference since it avoids introducing a significant breaking change: to be consistent we'd have to do the same with stored fields, source filtering, highlighting or sort orders. |
@Parth-Vader We're still having second thoughts regarding whether we want to raise an error, let's give @rjernst a chance to comment. |
While I think erroring would be better, @Parth-Vader could certainly implement the very simple optimization proposed, and deprecation/error could come later. |
This change adds a check so that when parsing the search source, script fields are ignored when the requested search result size is 0. This helps with e.g. clients like Kibana that sends a list of script fields that they may need for convenience, but they don't require any hits. Before this change, user sometimes ran into confusing behaviour, e.g. the script compilation limit to breaking although no hits were requested. Closes #31824
Today Kibana sends the list of script fields that it may need for convenience, even if it doesn't need any hits. This may be confusing to users sometimes when this causes for instance the script compilation limit to break. While things could be improved on the Kibana side, this issue looks easy to fix in
SearchService.parseSource
by just ignoring script fields when size is 0.The text was updated successfully, but these errors were encountered: