elasticsearch aggs和查询大小

时间:2015-12-14 13:50:26

标签: elasticsearch

我使用elasticsearch,但我对aggs有一点问题,因为我为我的查询设置了一个大小,如

$params ['body'] ['size'] = 1;

我使用像

这样的aggs
$params ['body'] ['aggs'] ['grouped_by_name'] = array (
            "terms" => array (
                    "field" => "title",
                    "size" => 0 
            ) 
    );

但是在我的doc_count中,我收到的不仅仅是为什么?

我只能接收我需要的aggs

1 个答案:

答案 0 :(得分:0)

$params ['body'] ['size'] = 1;  <------ this is how much hits you want, 0 mean 0

$params ['body'] ['aggs'] ['grouped_by_name'] = array (
        "terms" => array (
                "field" => "title",
                "size" => 1 <-------------- this size is how much of this aggs you want, 0 mean infinity 
        ) 
);