汇总返回的限制存储桶大小

时间:2019-05-26 09:36:35

标签: java elasticsearch

我有大量的Elasticsearch数据,我渴望进行汇总和返回存储桶。我需要限制从elasticsearch返回的数据大小,以便仅获取数据的样本,而不是所有数据。

我尝试添加“大小”属性。但这在存储聚合中是不可接受的。

{
  "size": 0,
  "query": {
    "bool": {
      "adjust_pure_negative": true,
      "boost": 1
    }
  },
  "aggregations": {
    "my_agg_1": {
      "histogram": {
        "field": "coAt",
        "interval": 86400,
        "offset": 1558216800,
        "order": {
          "_key": "asc"
        },
        "keyed": false,
        "min_doc_count": 1
      },
      "aggregations": {
        "my_agg_2": {
          "terms": {
            "field": "atr1",
            "missing": "NaN",
            "value_type": "string",
            "size": 2147483647,
            "min_doc_count": 1,
            "shard_min_doc_count": 0,
            "show_term_doc_count_error": false,
            "order": [
              {
                "_count": "desc"
              },
              {
                "_key": "asc"
              }
            ]
          },
          "aggregations": {
            "atr2": {
              "top_hits": {
                "from": 0,
                "size": 1,
                "version": false,
                "explain": false,
                "sort": [
                  {
                    "coAt": {
                      "order": "desc"
                    }
                  }
                ]
              }
            },
            "clientIP_count": {
              "value_count": {
                "field": "clientIP"
              }
            }
          }
        }
      }
    }
  }
}

0 个答案:

没有答案