首页 > 编程语言 > 详细

python Fielddata is disabled on text fields

时间:2018-10-10 11:17:35      阅读:256      评论:0      收藏:0      [点我收藏+]
# 执行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)

python Fielddata is disabled on text fields

原文:https://www.cnblogs.com/lajiao/p/9765144.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!