Elasticsearch get aggregation bucket size (number of elements in the bucket) without retrieving all data -


i trying information aggregation in elasticsearch.

i have index in store mail metadata (sender ip, subject etc.) i'm trying want number of ips send on 1000 mails. (so example let's have 3 ip addresses, 2000 mails sent first ip, 1500 second , 200 third ip. want see 2 aggregation result.) wrote following query:

get /my_index/_search {    "size": 0,    "aggs": {       "ipaddresses": {          "terms": {             "field": "senderipaddress",             "min_doc_count": 1000,             "size" : 0          }       }     } } 

i can bucket , calculate size in back-end implementation, need data in bucket in order this. slow , want bucket size without getting data.

tl;dr, how can total size of aggregation bucket without retrieving whole data?

this purpose of cardinality aggregation:

{  "size": 0,  "aggs": {     "ipaddressescount": {        "cardinality": {           "field": "senderipaddress"        }      }   } } 

keep in mind approximation -- precision can configured using precision_threshold documented in link above.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -