-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Validate agg order parameter at parse time #20003
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
Comments
I think the terms aggregation validates the order during the search phase. I get a |
Also the |
@qwerty4030 the parsing happens on the coordinating node (the node that receives the request from the client) but As for the discrepancy between order in the terms aggregation and the histogram aggregations, it would be nice to have them consistent. Maybe we could have both use the same |
I can see this happening in two parts:
1 doesn't seem too bad since the code already exists. 2 is more involved: I saw alot of |
@colings86 does this issue need further discussion? |
This commit adds support for histogram and date_histogram agg compound order by refactoring and reusing terms agg order code. The major change is that the Terms.Order and Histogram.Order classes have been replaced/refactored into a new class BucketOrder. This is a breaking change for the Java Transport API. For backward compatibility with previous ES versions the (date)histogram compound order will use the first order. Also the _term and _time aggregation order keys have been deprecated; replaced by _key. Relates to elastic#20003: now that all these aggregations use the same order code, it should be easier to move validation to parse time (as a follow up PR). Relates to elastic#14771: histogram and date_histogram aggregation order will now be validated at reduce time. Closes elastic#23613: if a single BucketOrder that is not a tie-breaker is added with the Java Transport API, it will be converted into a CompoundOrder with a tie-breaker.
This commit adds support for histogram and date_histogram agg compound order by refactoring and reusing terms agg order code. The major change is that the Terms.Order and Histogram.Order classes have been replaced/refactored into a new class BucketOrder. This is a breaking change for the Java Transport API. For backward compatibility with previous ES versions the (date)histogram compound order will use the first order. Also the _term and _time aggregation order keys have been deprecated; replaced by _key. Relates to #20003: now that all these aggregations use the same order code, it should be easier to move validation to parse time (as a follow up PR). Relates to #14771: histogram and date_histogram aggregation order will now be validated at reduce time. Closes #23613: if a single BucketOrder that is not a tie-breaker is added with the Java Transport API, it will be converted into a CompoundOrder with a tie-breaker.
Well now that step 1 was done in #22343 we can give part 2 a shot. @colings86 @javanna Do you guys see any obvious roadblocks to validate |
@qwerty4030 I don't see any roadblocks. I think this should be possible since the pipeline aggregations do something a little similar when validating the |
Sounds good. Thanks for the tip about the pipeline aggregations. I found some relevant code here, but I'm not sure how robust this validation is. |
@elastic/es-search-aggs |
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Changing this to a bug - to address that we are returning the correct error code. |
Pinging @elastic/es-analytical-engine (Team:Analytics) |
At the moment we don't validate that the order parameter for the histogram, date_histogram and terms aggregations is valid at parse time. Instead we rely on an exception to be thrown when we try to sort the buckets at reduce time. Apart from the not being a nice user experience as we should fail quickly on bad requests this also causes a few other issues highlighted in #14771 and #19851:
SearchPhaseExecutionException
which maps to a503 Unavailable
status code when in fact it should return a400 Bad Request
status code and ideal the exception should be aSearchParseException
The text was updated successfully, but these errors were encountered: