Show all Elasticsearch aggregation results/buckets and not just 10 -
i'm trying list buckets on aggregation, seems showing first 10.
my search:
curl -xpost "http://localhost:9200/imoveis/_search?pretty=1" -d' { "size": 0, "aggregations": { "bairro_count": { "terms": { "field": "bairro.raw" } } } }'
returns:
{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 16920, "max_score" : 0.0, "hits" : [ ] }, "aggregations" : { "bairro_count" : { "buckets" : [ { "key" : "barra da tijuca", "doc_count" : 5812 }, { "key" : "centro", "doc_count" : 1757 }, { "key" : "recreio dos bandeirantes", "doc_count" : 1027 }, { "key" : "ipanema", "doc_count" : 927 }, { "key" : "copacabana", "doc_count" : 842 }, { "key" : "leblon", "doc_count" : 833 }, { "key" : "botafogo", "doc_count" : 594 }, { "key" : "campo grande", "doc_count" : 456 }, { "key" : "tijuca", "doc_count" : 361 }, { "key" : "flamengo", "doc_count" : 328 } ] } } }
i have more 10 keys aggregation. in example i'd have 145 keys, , want count each of them. there pagination on buckets? can of them?
i'm using elasticsearch 1.1.0
the size param should param terms query example:
curl -xpost "http://localhost:9200/imoveis/_search?pretty=1" -d' { "size": 0, "aggregations": { "bairro_count": { "terms": { "field": "bairro.raw", "size": 0 } } } }'
as mentioned in doc works version 1.1.0 onwards
edit
updating answer based on @phaedrusthegreek comment.
setting size:0
deprecated in 2.x onwards, due memory issues inflicted on cluster high-cardinality field values. can read more in github issue here .
it recommended explicitly set reasonable value size
number between 1 2147483647.
Comments
Post a Comment