ElasticSearch - 二级嵌套聚合不正确的 doc_count

发布于 2025-01-10 22:06:25 字数 904 浏览 0 评论 0原文

ElasticSearch 7.10.1 嵌套聚合。

谁能指出为什么我的第二个嵌套聚合上的 doc_count 不正确? 第一个聚合的计数是准确的,但第二个聚合的计数不准确(两者都是关键字字段)。

{
  "size": 0,
  "_source": false,
  "query": {
    "match_all": {}
  },
  "aggs": {
    "products": {
      "nested": {
        "path": "productsImpacted"
      },
      "aggs": {
        "field1": {
          "terms": {
            "field": "productsImpacted.product.keyword",
            "size": 1000
          },
            "aggs": {
              "resellers": {
                "nested": {
                  "path": "requestType"
                },
                "aggs": {
                  "field2": {
                    "terms": {
                      "field": "requestType.type.keyword",
                      "size": 1000
                    }
                  }
                }
              }
            }
        }
      }
    }
  }
}

谢谢,

ElasticSearch 7.10.1 nested aggregations.

Can anyone point me to why the doc_count on my 2nd nested aggregation is not correct?
The count on the first aggregation is accurate but the 2nd isnt (both are keyword fields).

{
  "size": 0,
  "_source": false,
  "query": {
    "match_all": {}
  },
  "aggs": {
    "products": {
      "nested": {
        "path": "productsImpacted"
      },
      "aggs": {
        "field1": {
          "terms": {
            "field": "productsImpacted.product.keyword",
            "size": 1000
          },
            "aggs": {
              "resellers": {
                "nested": {
                  "path": "requestType"
                },
                "aggs": {
                  "field2": {
                    "terms": {
                      "field": "requestType.type.keyword",
                      "size": 1000
                    }
                  }
                }
              }
            }
        }
      }
    }
  }
}

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅笑依然 2025-01-17 22:06:25

ES'agg 不准确。
你使用sizeshard_size来提高精度就意味着性能的下降,可以参考官方文档:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-shard-size

ES’agg is inaccurate.
you cna use size and shard_size to improve accuracy means a decline in performance,You can refer to the official documents:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-shard-size

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文