Description
🐛 Wrong type
AggregationRange.from
and AggregationRange.to
were changed from string | number
to number
in #2552
From the PR:
AggregationRange accepting both double and string was probably established because at some point it was also used for RangeQuery, which accepts Objects for parameters to and from. But in the spec we just use it in GeoDistanceAggregation and RangeAggregation, both accepting only doubles. Since the java client generalizes string | double as just string, this results in the server throwing exceptions when called.
This was supposed to be done to address elastic/elasticsearch-java#666, but the assumption that was used for the PR is wrong, For RangeAggrations
at least, from
and to
do support string
type value, for patterns such as now
or now+X
.
E.g from the Kibana repo: