查询:
{
"fields" : [],
"size" : 0,
"aggs" : {
"top-terms" : {
"terms": {
"field" : "content",
"size" : 10
}
}
}
}
响应:
Array
(
[took] => 20475
[timed_out] =>
[_shards] => Array
(
[total] => 5
[successful] => 5
[failed] => 0
)
[hits] => Array
(
[total] => 2652291
[max_score] => 0
[hits] => Array
(
)
)
[aggregations] => Array
(
[top-terms] => Array
(
[doc_count_error_upper_bound] => 1214666
[sum_other_doc_count] => 831757781
[buckets] => Array
(
[0] => Array
(
[key] => the
[doc_count] => 2645615
)
[1] => Array
(
[key] => to
[doc_count] => 2638675
)
[2] => Array
(
[key] => of
[doc_count] => 2637099
)
[3] => Array
(
[key] => and
[doc_count] => 2633262
)
[4] => Array
(
[key] => a
[doc_count] => 2625627
)
[5] => Array
(
[key] => in
[doc_count] => 2621823
)
[6] => Array
(
[key] => for
[doc_count] => 2523026
)
[7] => Array
(
[key] => is
[doc_count] => 2480382
)
[8] => Array
(
[key] => on
[doc_count] => 2450387
)
[9] => Array
(
[key] => that
[doc_count] => 2447827
)
)
)
)
)
汇总2652291文件([总] => 2652291)
如何将文档数量限制为1000?
size: 1000
不起作用
“忽略此文字,我只是在这里添加它,所以stackoverflow让我发布问题。”
答案 0 :(得分:0)
通过添加限制过滤器
来实现它"filtered": {
"filter": {
"limit": {
"value": 200
}
}
}
限制过滤器限制要执行的文档数(每个分片)。 更多信息:Link