Hello,
I try to make a range query but i can’t figure out how to put alias on my dateRanges as i can do it directly in ElasticSearch :
"date_range": {
"field": "randomDateField",
"ranges": [{
"key": "range1",
"to": "now-29d"
},
{
"key": "range2",
"from": "now-25d",
"to": "now-29d"
},
{
"key": "range3",
"from": "now-20d",
"to": "now-25d"
},
{
"key": "range4",
"from": "now-19d"
}]
}
AggregationKey<Map<Range<Instant>, Long>> agg = AggregationKey.of( "myAgg" );
...
.aggregation(agg, f -> f.range()
.field("randomDateField", Instant.class, ValueConvert.NO)
.range("range1", to, from) // i would like to have something like that here.
.range("range2", to, from)
Maybe it can be done with some extension like .extension(ElasticsearchExtension.get()) or trick that i’am not aware of ?
thank for your help !