python Fielddata is disabled on text fields

Posted naniandiam

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python Fielddata is disabled on text fields相关的知识,希望对你有一定的参考价值。

# 执行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的主要内容,如果未能解决你的问题,请参考以下文章

ES关键字排序报错 reason=Fielddata is disabled on text fields by default. Set fielddata=true on 关键字 in order

Fielddata is disabled on text fields by default. Set fielddata=true on [gender] in order to load fie

ES关键字排序报错 reason=Fielddata is disabled on text fields by default. Set fielddata=true on 关键字 in order

ES关键字排序报错 reason=Fielddata is disabled on text fields by default. Set fielddata=true on 关键字 in order

ElasticsearchFielddata is disabled on text field fielddata=true

55.fielddata内存控制以及circuit breaker断路器