ElasticSearch Multi Aggregation

时间:2017-04-04 15:05:04

标签: elasticsearch aggregation

我想知道是否有可能检索不属于响应的文档的聚合键/计数器。我的意思是放在 sum_other_doc_count 字段中的文件。

我的聚合代码如下:

AggregationBuilder agg = AggregationBuilders.terms("AGG_1").field("field1")
            .subAggregation(AggregationBuilders.terms("AGG_2").field("field2")
                    .subAggregation(AggregationBuilders.terms("AGG_3").field("field3")
                            .subAggregation(AggregationBuilders.terms("AGG_4").field("field4"))));

我在AGG_2上有5个不属于回复的文件,但我和其他文件一样需要它们。

"AGG_1": {
     "doc_count_error_upper_bound": 0,
     "sum_other_doc_count": 0,
     "buckets": [
        {
           "key": "404",
           "doc_count": 3506,
           "AGG_2": {
              "doc_count_error_upper_bound": 0,
              "sum_other_doc_count": 0,
              "buckets": [
                 {
                    "key": "OK",
                    "doc_count": 1206,
                    "AGG_3": {
                       "doc_count_error_upper_bound": 0,
                       "sum_other_doc_count": 5,
                       "buckets": [ ...

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

您可以为<div id="review-bonus"> <div id="review-bonus-inner"><div id="bonus-left"> <img src="http://www.iconarchive.com/download/i60915/himacchi/sweetbox/gift.ico"> </div><div id="bonus-right"> <h3 id="bonus-title">FREE</h3> <p id="bonus-description">f jdkl fnjfn rweofnrfnfndafndffn ddfd fdhfanjk herowf fhrgfndfndf wfefnanf fefnf f hqaf hef fewh f hfewanf f aWFH F HWEEFNDNADS ANDJFDNF E </p> <ul> <li>g erj iroehgnvfd f nvjvhrnvjf nevj nvonvrfvnfvn envdvn nfereonovfnjofnvf oegnpvnfdonvfognoa</li> <li>fndj iofgh rionrn ;nn oej rejbnvofn noe revofnoa;gvan</li> <li>h trhth thwgh 4t ththhthtw th aregtrhw</li> <li>htr htrh twh htrh thth twhtr hwht w</li> <li>grtg regh htrw hthtthwhth tr th twhw hhttwhtrh w h</li> </ul> </div> </div> </div>设置不同的size值,以指定您希望获得的每个桶数

terms aggregations