Elasticsearch Pipelining through a Child Aggregation

大憨熊 提交于 2019-12-06 14:12:41

I'm guessing that this is a bug.

When I took this part out:

        "total_active_ministers_by_unit": {
           "sum_bucket": {
              "buckets_path": "ministers>active_minister_by_ministry.value"
           }
        },

I got these results:

{
   "took": 5,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 8,
      "max_score": 0,
      "hits": []
   },
   "aggregations": {
      "unit": {
         "doc_count_error_upper_bound": 0,
         "sum_other_doc_count": 0,
         "buckets": [
            {
               "key": "3a7d74d8bfc6b841",
               "doc_count": 3,
               "ministers": {
                  "doc_count": 2,
                  "ministry": {
                     "doc_count_error_upper_bound": 0,
                     "sum_other_doc_count": 1,
                     "buckets": [
                        {
                           "key": 2,
                           "doc_count": 1,
                           "active_minister": {
                              "doc_count": 1
                           },
                           "ministry_type": {
                              "doc_count_error_upper_bound": 0,
                              "sum_other_doc_count": 0,
                              "buckets": [
                                 {
                                    "key": "District Evangelist",
                                    "doc_count": 1
                                 }
                              ]
                           }
                        }
                     ]
                  },
                  "active_minister_by_ministry": {
                     "value": 1
                  }
               }
            },
            {
               "key": "3a7d74e834bbc0d6",
               "doc_count": 2,
               "ministers": {
                  "doc_count": 1,
                  "ministry": {
                     "doc_count_error_upper_bound": 0,
                     "sum_other_doc_count": 0,
                     "buckets": [
                        {
                           "key": 2,
                           "doc_count": 1,
                           "active_minister": {
                              "doc_count": 1
                           },
                           "ministry_type": {
                              "doc_count_error_upper_bound": 0,
                              "sum_other_doc_count": 0,
                              "buckets": [
                                 {
                                    "key": "Apostle",
                                    "doc_count": 1
                                 }
                              ]
                           }
                        }
                     ]
                  },
                  "active_minister_by_ministry": {
                     "value": 1
                  }
               }
            },
            {
               "key": "3a7b3abb09bfec65",
               "doc_count": 1,
               "ministers": {
                  "doc_count": 0,
                  "ministry": {
                     "doc_count_error_upper_bound": 0,
                     "sum_other_doc_count": 0,
                     "buckets": []
                  },
                  "active_minister_by_ministry": {
                     "value": 0
                  }
               }
            },
            {
               "key": "3a7d707e45c8dc24",
               "doc_count": 1,
               "ministers": {
                  "doc_count": 0,
                  "ministry": {
                     "doc_count_error_upper_bound": 0,
                     "sum_other_doc_count": 0,
                     "buckets": []
                  },
                  "active_minister_by_ministry": {
                     "value": 0
                  }
               }
            },
            {
               "key": "3a7d70975c84428c",
               "doc_count": 1,
               "ministers": {
                  "doc_count": 0,
                  "ministry": {
                     "doc_count_error_upper_bound": 0,
                     "sum_other_doc_count": 0,
                     "buckets": []
                  },
                  "active_minister_by_ministry": {
                     "value": 0
                  }
               }
            }
         ]
      }
   }
}

But trying to pipeline across the parent/child relationship causes an error.

This probably ought to be reported as a bug, unless I'm missing something.

Here is the code I used to test it out:

http://sense.qbox.io/gist/075732dfe51916538ff13ea76a2cec1f7532c691

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!