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)

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

时间: 2024-10-08 14:56:54

python Fielddata is disabled on text fields的相关文章

Fielddata is disabled on text fields by default. Set fielddata=true on [gender] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memor

ES进行如下聚合操作时,会报如题所示错误: 1 ? Downloads curl -XPOST 'localhost:9200/bank/_search?pretty' -d ' 2 { 3 "size": 0, 4 "aggs": { 5 "group_by_state": { 6 "terms": { 7 "field": "state" 8 } 9 } 10 } 11 }' 提示报

es进行聚合操作时提示Fielddata is disabled on text fields by default

根据es官网的文档执行 GET /megacorp/employee/_search { "aggs": { "all_interests": { "terms": { "field": "interests", "size": 10 } } } } 这个例子时,报错: { "error": { "root_cause": [ { "ty

Elasticsearch 报错:Fielddata is disabled on text fields by default. Set `fielddata=true` on [`your_field_name`] in order to load fielddata in memory by uninverting the inverted index.

Elasticsearch 报错: Fielddata is disabled on text fields by default. Set `fielddata=true` on [`your_field_name`] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. 解决:https://www.e

Kibana error " Fielddata is disabled on text fields by default. Set fielddata=true on [publisher] ..."

Reason of this error:Fielddata can consume a lot of heap space, especially when loading high cardinality text fields. Once fielddata has been loaded into the heap, it remains there for the lifetime of the segment.Also, loading fielddata is an expensi

Fielddata is disabled on text fields by default Set fielddata=true on [service.address]

2个字段的: PUT metricbeat-7.3.0/_mapping { "properties": { "service": { "properties": { "address": { "type": "text", "fielddata": true, "fields": { "keyword": { "ty

python cookbook —— Searching and Replacing Text in a File

要将文件中的某一个字符串替换为另一个,然后写入一个新文件中: 首先判断输入格式,至少需要输入被搜索的Text和替换的Text,输入输出文件可以是存在的文件,也可以是标准输入输出流 (os.path是个好东西) import os, sys nargs = len(sys.argv) if not 3 <= nargs <= 5: print "usage: %s search_text replace_text [infile [outfile]]" % os.path.b

【转】Python数据类型之“文本序列(Text Sequence)”

[转]Python数据类型之“文本序列(Text Sequence)” Python中的文本序列类型 Python中的文本数据由str对象或字符串进行处理. 1.字符串 字符串是Unicode码值的不可变序列.字符串字面量有多种形式: 单引号:'允许嵌入"双"引号' 双引号:"允许嵌入'单'引号" 三引号:'''三个单引号''', """三个双引号""" 说明: a) 三引号的字符串可以跨越多行,所关联的空

python安装环境配置、python模块添加、sublime text编辑器配置

本文讲述的是  windows环境 python相应的安装配置. 第一步,进入官网找安装包,官网地址如下:https://www.python.org/downloads/ 找到相应2.7.x或3.x版本下载,注意请一定要确认需求是2.7或是3.x的,python这两个版本之间库相差很大. 这里假设你安装的地址为 D:\python,以下为详细的配置步骤: 1.点击进入我的电脑 2.选取系统属性,如图 3.点击高级系统设置,如图 4.点击环境变量按钮,找到系统变量栏里的Path变量,双击,添加以

配置Sublime Text2的python运行环境(Sublime Text 3也类似)

1. 前言 用Sublime Text 2 配置Python运用环境,有简单配置还有像IDLE一样的配置,本文分成第一部分和第二部分. 2. 配置 第一部分(简单配置) 1. 只需要打开Preferences 的 Browse Packages找到Python 文件夹中的Python.sublime-build文件. 2. 添加我们安装python的路径就ok了. 3.Sublime Text2会自动的判断类型build 按 ctrl + b 即可运行 输出在自身的控制台中,部署到这一步,就可以