# 执行https://www.elastic.co/guide/cn/elasticsearch/guide/current/_aggregation_test_drive.html中的例子时报错Fielddata is disabled on text fields ,只需要在查询的fields后面加上.kewwords即可
# 参考https://blog.csdn.net/u011403655/article/details/71107415/
def curl_es(data):
res = es.search(index="cars", doc_type="transactions", body=data)
print(res)
body = {
"size" : 0,
"aggs" : {
"popular_colors" : {
"terms" : {
"field" : "color.keyword" #加上keyword就不报错了
}
}
}
}
curl_es(body)
原文地址:https://www.cnblogs.com/lajiao/p/9765144.html
时间: 2024-10-08 14:56:54