Elasticsearch:如何返回聚合中的所有构面值

时间:2015-03-13 01:39:05

标签: elasticsearch

我正在通过阅读名为Elasticsearch Cookbook(2ed)的书来学习Elasticsearch。它有以下示例查询:

{
    "query": {
        "match_all": {}
    },
    "aggs": {
        "tag": {
            "terms": {
                "field": "tag",
                "size": 10
            }
        }
    }
}

根据这本书,

size (by default 10): This controls the number of facets value that is to be returned.

我很好奇:如果我事先不知道facet值的总数,如何返回所有facet值?

很抱歉,如果我的问题非常明显。

谢谢和问候。

1 个答案:

答案 0 :(得分:1)

将size设置为0(与将其设置为Integer.MAX_VALUE相同)

但要小心,因为如果你有很多方面的价值,这将会表现得非常糟糕。

请参阅http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html