Hello,
I am trying to ‘minus’ operation after below terms aggregation.
GET test02/_search
{
"aggs": {
"txid_aggs": {
"terms": {
"field": "txid.keyword",
"size": 10
},
"aggs": {
"logdate_aggs": {
"terms": {
"field": "logdate",
"size": 10
}
}
}
}
},
"size": 0
}
result looks like below but i don’t know how i can do minus operation with "key " field values from the aggregation result
(e.g. "2019-06-05T01:51:44.498Z" - "2019-06-05T01:51:48.498Z").
{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 6,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"txid_aggs" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "67890ba-d7db-4367-a0c8-fbeffb7c9dfb",
"doc_count" : 2,
"logdate_aggs" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : 1559699504498,
"key_as_string" : "2019-06-05T01:51:44.498Z",
"doc_count" : 1
},
{
"key" : 1559699508498,
"key_as_string" : "2019-06-05T01:51:48.498Z",
"doc_count" : 1
}
]
}
}
]
}
}
}
please advise. thank you!!!