0
下面的查询给出elasticsearch我的文档的词汇量的大小:在如何在python中打印elasticsearch的查询结果?
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 84678,
"max_score": 0,
"hits": []
},
"aggregations": {
"vocab": {
"value": 178050**
}
}
}
现在我想打印领域的“值”的值(= 178050):
GET my_index/my_type/_search
{
"size": 0,
"aggs": {
"vocab": {
"cardinality": {
"field": "text"}}}}
输出是蟒蛇。
我写在Python以下几点:
query_body={
"size": 0,
"aggs": {
"vocab": {
"cardinality": {
"field": "text"}}}}
res = es.search(index = INDEX_NAME, body=query_body)
我怎么能打印的价值?谢谢。
非常感谢!这工作。 – farha
如果答案有帮助,请回覆/标记为已回答。 – 2ps