-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Order not working inside a date_histogram aggs ES 2.0 #14771
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
This is weird for a few reasons...
Full example:
@colings86 any ideas? |
I get the same as @clintongormley. This is a bug because an exception should be thrown and the status code returned should be 400 (bad request). |
Updated SearchPhaseExecutionException to determine the status from the cause if one exists and there were no shard failures. Throw exception if (date) histogram order path is invalid and there is only one bucket. Forced check of sub-aggregation names and fields used in (date) histogram order path if there is only one bucket. The previous code relied on the sorting code (bypassed if less than 2 buckets) to do this check. Ideally these checks should be performed during parsing instead of the reduce phase. Closes elastic#14771
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.
As of #22343
The |
@elastic/es-search-aggs |
Actually, closing in favor of #20003 Sorry for the noise :) |
POST http://localhost:9200/searchaggtests/searchaggtest/_search?&search_type=count HTTP/1.1
Content-Type: application/json
Host: localhost:9200
Content-Length: 289
Expect: 100-continue
{"aggs":{"testHistogramBucketAggregation":{"date_histogram":{"field":"dateofdetails","interval":"1M","format":"yyyy-MM-dd","offset":"1d","time_zone":"+02:00","order":{"dateofdetails":"desc"},"min_doc_count":2,"extended_bounds":{"min":0,"max":1000000}},"aggs":{"tophits":{"top_hits":{}}}}}}
Result:
HTTP/1.1 503 Service Unavailable
Content-Type: application/json; charset=UTF-8
Content-Length: 293
{"error":{"root_cause":[],"type":"reduce_search_phase_exception","reason":"[reduce] ","phase":"query","grouped":true,"failed_shards":[],"caused_by":{"type":"illegal_argument_exception","reason":"Invalid order path [dateofdetails]. Cannot find aggregation named [dateofdetails]"}},"status":503}
Greetings Damien
The text was updated successfully, but these errors were encountered: