Aggregation on nested node and stats on parent fields

I am new to elasticsearch please help me

Please find the mapping so that I can explain what is the out put required.

PUT /myproject/contact/_mapping
{
"contact": {
"properties": {
"emailid": {
"type" :"text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"phonenumber": {
"type" :"text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"personaladdress":{
"type":"nested",
"properties": {
"city": {
"type": "text",
"fields":{
"keyword": {
"type": "keyword"
}
}
}
}
}
}
}
}

I am looking an aggregation query where it give the out put

City wise (nested doc) how many email / phone number we have

City | Email | Phone number |
Bangalore | 50 | 30 |
Another City | 10 | 5 |

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.