Hello,
I have following parent child mapping (https://www.elastic.co/guide/en/elasticsearch/guide/current/parent-child-mapping.html).
PUT /site
{
"mappings": {
"blog": {
"properties" : { "visited": { "type": "long" }
},
"comment": {
"_parent": {
"type": "blog",
"properties" : { "tag": { "type": "string" } }
}
}
}
}
}
I want to sum "visited" in parent document "blog" for every unique values of "tag" in child document "comment".
{
"size": 0,
"query": {
{ "match_all" : { } }
},
"aggs": {
"by_tags": {
"children": {
"type": "comment"
},
"terms": { "field": "tag" }
"aggs": {
"visited": { "sum": { "field": "visited" } }
}
}
}
}
It is not working. Am I doing something wrong, or it is not possible?
Thanks,
-Soumitra.