I am working on ElasticSearch 2.3.1. I have a requirement to fetch data for last 90 days. In this I need data as well as minute wise aggregation. Problem which I am facing is that I am able to get data for last 90 days but not able to apply date range on the aggregation.
So I have two problems
Problem 1 – This should work on a result set of a match query field is different.
Problem 2 – Java API for the above query
Query which I am using is as follows:
GET _search
{
"aggs": {
"t1": {
"filter": {
"range": {
"timestamp": {
"from" : "now-1d/d",
"to" : null,
"format" : "epoch_millis",
"include_lower" : true,
"include_upper" : true
}
}
},
"aggs": {
"t2": {
"date_histogram": {
"field": "timestamp",
"interval": "1m"
}
}
}
}
}
}
In short I need Java API of following type
Java API for full:
match query {
aggregation {
filter aggregation,
date histogram
}
}