【问题标题】:Filter on the aggregation doc_count in elasticsearch在 elasticsearch 中过滤聚合 doc_count
【发布时间】:2020-05-26 03:57:32
【问题描述】:

我正在研究弹性搜索并尝试根据 doc_count 过滤聚合数据。有 min_doc_count 我可以提到最小 doc_count。但是,如果我想找到 doc_count 等于或小于给定数字的聚合结果怎么办?有没有办法解决这个问题?

GET interaction-v2/_search
{
  "size": 0,
  "aggs": {
    "group_by_user": {
      "terms": {
        "field": "customer_id",
        "size": 10
      }
    }
  }
}

【问题讨论】:

  • 这个答案应该会有所帮助:stackoverflow.com/questions/51623147/…
  • 你可以在这里找到解决方案discuss.elastic.co/t/…
  • 谢谢你们的帮助,我已经尝试了@Pierre Mallet 链接,但它不起作用,因为在“源”只有“the_doc_count”不起作用,需要写成“params.the_doc_count”!

标签: elasticsearch kibana


【解决方案1】:

答案在这里:Elasticsearch filter aggregations on minimal doc count

为了节省您的查找时间:

aggs: {
    field1: {
        terms: {
            field: 'field1',
            min_doc_count: 1000
        },

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-09
    • 1970-01-01
    • 2016-12-02
    • 1970-01-01
    • 2015-09-17
    • 2014-02-02
    • 2015-11-14
    相关资源
    最近更新 更多