Elasticsearch Java HighLevelRestClient计数API警告字段扩展匹配太多字段

时间:2019-11-18 10:30:35

标签: java elasticsearch rest-client

我正在使用弹性搜索6.6.1,并使用高级rest客户端Java API来获取与如下查询匹配的记录数

BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
        boolQueryBuilder.must(QueryBuilders.queryStringQuery("api:test").analyzeWildcard(true));
        boolQueryBuilder.must(QueryBuilders.rangeQuery("@timestamp").gte(startTimeInMillis).lte(endTimeInMillis).format("epoch_millis"));
        builder.query(boolQueryBuilder);
        countRequest.source(builder);
        try {
            CountResponse countResponse = restHighLevelClient.count(countRequest, RequestOptions.DEFAULT);
            long hitCount = countResponse.getCount();
            return hitCount;
        } catch (Exception ex) {
            ex.printStackTrace();
        }

但是当它执行时,我得到以下警告

Field expansion matches too many fields, got: 1647. This will be limited starting with version 7.0 of Elasticsearch. The limit will be detemined by the indices.query.bool.max_clause_count setting which is currently set to 1024. You should look at lowering the maximum number of fields targeted by a query or increase the above limit while being aware that this can negatively affect your clusters performance

我了解我可以通过增加indexs.query.bool.max_clause_count来解决此警告,但我不明白警告的原因,因为我没有在查询中提取字段

0 个答案:

没有答案