Elasticsearch-使用样本大小的聚合

发布于 2025-02-01 10:17:34 字数 231 浏览 1 评论 0原文

我有一个具有大量记录的Elasticsearch数据库。我的数据具有数字得分标签。我正在汇总特定label得分字段的中位数和四分位数。例如,使用标签foo的所有文档的中值分数是多少。

有谁知道是否可以将这些百分位聚合基于统计意义的数据样本而不是完整集合,以加快聚合查询?

谢谢!

I have an ElasticSearch database that has a large number of records. My data has a numeric score and label. I am aggregating the median and quartiles of the score field for a specific label. For example, what is the median score of all documents with the label foo.

Does anyone know if it's possible to base those percentile aggregations on a statistically significant sample of the data, instead of the full set, in order to speed up the aggregation query?

Thanks!

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

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

发布评论

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

评论(1

爱你不解释 2025-02-08 10:17:34

您可以使用术语查询或任何其他查询来过滤文档并将汇总应用于这些结果。
这样一来,攻击不仅对查询结果的所有文档应用。

{
  "query": {
    "term": {
      "field_name": {
        "value": "foo"
      }
    }
  },
  "aggs": {
    "name_example": {
    "avg": {
        "field": "field_name"
      }
    }
  }
}

You can use a Term Query or any other query to filter the documents and apply aggregation to those results.
That way the aggression is not applied to all documents only to the query result.

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