简体   繁体   English

ES 中的聚合是否适用于 es 索引中的所有文档(查询全部匹配)

[英]Does aggregation in ES works on all the docs(with query match all) in es index

Let's suppose I have 10^6 docs in my Es index.假设我的 Es 索引中有 10^6 个文档。 Will aggregation work on all the docs to get results.将聚合所有文档以获得结果。

GET myindex/_search
{
 "size":0,
"aggs":{
"Unique_term":{
"terms":{
"field":"category",
"size":"10000"
}
}
}
}

Also the distinct terms I want to get are less than 10k.此外,我想获得的不同条款少于 10k。

Yes, the terms aggregation will give you the result where buckets will be built based on each unique value from the category是的,术语聚合将为您提供基于category中每个唯一值构建存储桶的结果

If no size param is set then by default it returns only 10 buckets如果没有设置size参数,那么默认情况下它只返回 10 个桶

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM