[Elasticsearch] 使用 Group by 语法 aggs

  • 字段:file.url
    GET test/_search
    {
    "aggs": {
      "all_": {
        "terms": { 
          "field":"file.url" 
        }
      }
    },
    "size": 0
    }
    结果:
    {
    "took" : 7,
    "timed_out" : false,
    "_shards" : {
      "total" : 1,
      "successful" : 1,
      "skipped" : 0,
      "failed" : 0
    },
    "hits" : {
      "total" : {
        "value" : 47,
        "relation" : "eq"
      },
      "max_score" : null,
      "hits" : [ ]
    },
    "aggregations" : {
      "all_" : {
        "doc_count_error_upper_bound" : 0,
        "sum_other_doc_count" : 9,
        "buckets" : [
          {
            "key" : "www.baidu.com",
            "doc_count" : 24
          },
          {
            "key" : "www.google.com",
            "doc_count" : 23
          },
          {
            "key" : "www.bing.com",
            "doc_count" : 4
          }
        ]
      }
    }
    }
本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!