Following query gives the vocabulary size of my document in elasticsearch:
GET my_index/my_type/_search
{
"size": 0,
"aggs": {
"vocab": {
"cardinality": {
"field": "text"}}}}
The output is:
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 84678,
"max_score": 0,
"hits": []
},
"aggregations": {
"vocab": {
"value": 178050**
}
}
}
Now I want to print the value of the field "value"(=178050) in python.
I wrote the following in python:
query_body={
"size": 0,
"aggs": {
"vocab": {
"cardinality": {
"field": "text"}}}}
res = es.search(index = INDEX_NAME, body=query_body)
How can I print that value? Thanks.