Skip to content

Instantly share code, notes, and snippets.

@durgaharish1993
Last active September 16, 2019 04:18
GET prefix-01-2019,prefix-02-2019/_search
{
"track_total_hits": true,
"size": 0,
"query": {
"bool": {
"filter": [
{
"range": {
"date_val": {
"gte": "2019-01-01",
"lte": "2019-02-28",
"format": "yyyy-MM-dd"
}
}
}
]
}
},
"aggs": {
"dimension1_values": {
"terms": {
"field": "dimension1.keyword",
"size": 5000
},
"aggs": {
"dimension2_values": {
"terms": {
"field": "dimension2.keyword",
"size": 6
},
"aggs": {
"dates": {
"date_histogram": {
"field": "date_val",
"interval": "day"
},
"aggs": {
"metric1": {
"sum": {
"field": "metric1"
}
},
"metric2":{
"cardinality": {
"field": "metric2.keyword"
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment