Aggregation on Nested Field of child document with nested aggregation on parent document

Hey , Can anyone help me with this , the buckets are not formed by elastic search .
What i want to is -
Aggregate on a nested field present in child document[object.name] and further aggregate them their parent documents to get the doc counts of parent .

Mapping ----------->

 "album" : {
        "properties" : {
          "frames" : {
            "type" : "long",
            "index" : false,
            "store" : true
          },
          "network" : {
            "type" : "keyword",
            "store" : true
          }
      }
    }
  "object" : {
        "type" : "nested",
        "properties" : {
          "confidence" : {
            "type" : "long",
            "store" : true
          },
          "height" : {
            "type" : "long",
            "index" : false,
            "store" : true
          },
          "name" : {
            "type" : "text",
            "store" : true,
            "norms" : false,
            "fields" : {
              "keyword" : {
                "type" : "keyword"
              }
            },
            "analyzer" : "shingle_analyzer"
          }
}
      "my_join_field" : {
        "type" : "join",
        "eager_global_ordinals" : true,
        "relations" : {
          "video" : "frame"
        }
      },

}

=======================================================================

Child Document ---------->

 "_source" : {
  "object" : [
        {
          "confidence" : 89.78,
          "name" : "Crowd",
          "recog_object_types" : [
            "OBJECT"
          ]
        },
        {
          "confidence" : 59.35,
          "name" : "Audience",
          "recog_object_types" : [
            "OBJECT"
          ]
        }
]
 "my_join_field" : {
        "name" : "frame",
        "parent" : "fc6ac4b6-600d-41c3-8de0-1950d794c246"
      }
 }

===============================================================================

Parent Document --------->

"_source" : {
"id_es" : "fc6ac4b6-600d-41c3-8de0-1950d794c246",
"album" : {
  "uuid" : "4f810024-972b-4ee9-83db-aa6e1ba89760",
  "remote_id" : "gkr57P0fwbI",
  "network" : "YOUTUBE"
},
  "my_join_field" : "video"
 }

===============================================================================

Query I am Executing-------->

GET video-1/_search
{
 "size": 0, 
 "aggs": {
 "object": {
  "nested": {
    "path": "object"
  }, 
  "aggs": {
    "object":{
  "terms": {
    "field": "object.name.keyword",
    "size": 20
  },
  "aggs": {
  "video": {
    "parent": {
      "type": "frame"
    },
    "aggs": {
      "netowrk": {
          "terms": {
            "field": "album.network",
            "size": 10
          }
      }
    }
  } 
}
  }
  }
}

}

===============================================================================

Results -------------------- > No buckets Are Formed

 "aggregations" : {
 "object" : {
  "doc_count" : 22257571,
  "object" : {
    "doc_count_error_upper_bound" : 115666,
    "sum_other_doc_count" : 14641596,
    "buckets" : [
      {
        "key" : "Human",
        "doc_count" : 1042039,
        "video" : {
          "doc_count" : 0,
          "netowrk" : {
            "doc_count_error_upper_bound" : 0,
            "sum_other_doc_count" : 0,
            "buckets" : [ ]
          }
        }
      },
      {
        "key" : "Person",
        "doc_count" : 1000239,
        "video" : {
          "doc_count" : 0,
          "netowrk" : {
            "doc_count_error_upper_bound" : 0,
            "sum_other_doc_count" : 0,
            "buckets" : [ ]
          }
        }
      },
      {
        "key" : "People",
        "doc_count" : 934566,
        "video" : {
          "doc_count" : 0,
          "netowrk" : {
            "doc_count_error_upper_bound" : 0,
            "sum_other_doc_count" : 0,
            "buckets" : [ ]
          }
        }

==============================================================================
Can anyone help me with this , elastic search is not making any bucket of parent documents if i am aggregating with nested fields in child document but if use non nested field of child document it works fine .

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