-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Script in terms aggregation that is not a value script should fail with descriptive failure message #11728
Comments
I have same issue. Value script in terms aggregation breaks migration from terms facet (I've already posted question about such migration https://stackoverflow.com/questions/31006983/migration-from-terms-facet-to-terms-aggregation) |
@luckywin just to be sure: you know that removing the "fields" parameter in the aggregation should make your script work? |
@brwe yes, I knew this, thank you. After removing "field" parameter, agg starts responding with "true" and "false" as a result of aggregation, and this is not expected result for me. I also tried to modify script to return doc['field'].value (or null when I want to exclude value from agg), but it not worked correctly too. Finally seems I've found workaround by using _source.field and null as returned values. Anyway, descriptive failure message for "not value script" can save lot of time for elastic users. |
cc @elastic/es-search-aggs |
In #31532 we decided not to deprecate "value scripts", which are still not very well documented. I am not getting cryptic failure messages anymore. The first example works as expected. We could add a deprecation warning on absence of |
We discussed the issue and we would like to start sending warnings to users if |
Closing as not planned, focus on ESQL development. Painless has helped with this issue. |
When a script is not a value script in a terms aggregation then the request must not contain the "fields" parameter.
However, there is no warning to the user if the request has the "fields" parameter anyway. The aggregation will just fail with cryptic error messages or even worse just silently not do the right thing.
This fails with an ArrayIndexOutOfBoundsException:
This silently just does not do the right thing (returns one bucket with key 0 and all docs in it):
The text was updated successfully, but these errors were encountered: