Hi,
I have putting data in elastic search something like this:
Data 1:
{
"app": "pigeon",
"time": "2019-03-28T06:22:02.175517",
"email": [
{ "flow_name" : "AuthOTP",
"1": 80,
"2": 79,
"3": 12,
"4": 60
}
]
,
"sms": [
{ "flow_name" : "Booking_Voucher",
"1": 20,
"2": 17
},
{ "flow_name" : "AuthOTP",
"1": 80,
"2": 79,
"3": 12
}
],
"message": "STATS_PER_TAG",
"cd": "2019-03-28T11"
}
Data 2:
{
"app" : "pigeon",
"time" : "2019-03-28T06:22:02.175517",
"sms" : [
{
"flow_name" : "AuthOTP",
"4" : 60
}
],
"message": "STATS_PER_TAG",
"cd": "2019-03-28T11"
}
I want aggregate count of "1" , "2", "3" and "4" per flow name.
My query
{
"_source" : false,
"query": {
"nested": {
"path": "sms",
"query": {
"bool": {
"must": [
{ "match": { "sms.flow_name": "AuthOTP" }}
]
}
},
"inner_hits": {}
}
},
"aggs" : {
"queued" : {
"sum" : { "field" : "sms.1" }},
"sent" : {
"sum" : { "field" : "sms.2" }
},
"failed" : {
"sum" : { "field" : "sms.3" }
},
"delivered" : {
"sum" : { "field" : "sms.4" }
}
}
}
This is returning aggregate count of all sms irrespective of flow names.
Please Help.