Elasticsearch:如何获得结果桶大小

时间:2019-01-17 08:36:49

标签: elasticsearch statistics bucket

这是我的查询结果

GET _search
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "serviceName.keyword": "directory-view-service"
          }
        },
        {
          "match": {
            "path": "thewall"
          }
        },
        {
          "range": {
            "@timestamp": {
              "from": "now-31d",
              "to": "now"
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "by_day": {
      "date_histogram": {
        "field": "date",
        "interval": "7d"
      },
      "aggs": {
        "byUserUid": {
          "terms": {
            "field": "token_userId.keyword",
            "size": 150000
          },
          "aggs": {
            "filterByCallNumber": {
              "bucket_selector": {
                "buckets_path": {
                  "doc_count": "_count"
                },
                "script": {
                  "inline": "params.doc_count <= 1"
                }
              }
            }
          }
        }
      }
    }
  }
}

我希望我的查询返回所有用户呼叫我的端点分钟。每隔1个月一次,间隔7天,直到一切都好为止

但是我的结果是一个具有370个元素的存储桶,我只需要知道数组大小...

有没有关键字或如何处理?

谢谢

0 个答案:

没有答案