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": [
      {
        "type": "illegal_argument_exception",
        "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [interests] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "megacorp",
        "node": "-Md3f007Q3G6HtdnkXoRiA",
        "reason": {
          "type": "illegal_argument_exception",
          "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [interests] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
        }
      }
    ],
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [interests] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
    }
  },
  "status": 400
}

原因是聚合这些操作用单独的数据结构(fielddata)缓存到内存里了,需要单独开启,官方解释在此 fielddata

简单来说就是在聚合前执行如下操作:

PUT megacorp/_mapping/employee/
{
  "properties": {
    "interests": {
      "type":     "text",
      "fielddata": true
    }
  }
}

原文地址:https://www.cnblogs.com/mentiantian/p/10510477.html

时间: 2024-07-30 14:22:32

es进行聚合操作时提示Fielddata is disabled on text fields by default的相关文章

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 }' 提示报

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 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): re

git操作时提示:fatal: pathspec 'README' did not match any files 的处理办法

根据网上教程使用git,结果没几步就开始出问题... 就是个简单的git add 看到提示的fatal,下意识的认为很严重,开始以为跟大小写有关,结果试了下还是不行 加上文件的后缀名,搞定. 并且跟大小写无关 建议:各位同学操作时,注意后缀名的问题.操作系统中隐藏了后缀名的话,命令中就不要加:如果没有设置隐藏后缀名,命令中不能丢掉 git操作时提示:fatal: pathspec 'README' did not match any files 的处理办法 原文地址:https://www.cn

sql server 2008 r2 数据库操作时提示 9002错误“事物日志已满”问题

事务日志截断 若要避免数据库的事务日志被填满,例行备份至关重要.在简单恢复模式下,备份了数据库后会自动截断日志,而在完整恢复模式下,只有备份了事务日志后方才截断日志.但是,截断过程有时也可能发生延迟.有关识别和应对各种延迟因素的信息,请参阅可能延迟日志截断的因素. 注意  BACKUP LOG WITH NO_LOG 和 WITH TRUNCATE_ONLY 选项已废止.使用完整恢复模式或大容量日志恢复模式时,如果必须删除数据库中的日志备份链,请切换至简单恢复模式.有关详细信息,请参阅有关从完整

Python操作mysql数据库查询操作时提示“unread-result-found”

原因描述: 当Windows操作系统损坏时,会出现"unread-result-found"错误,比如启动程序将会变慢,响应时间将会延迟.当运行多个应用程序时,可能会遇到崩溃和死机.这个错误可能有很多原因,包括过多的启动条目.注册表错误.硬件/RAM下降.碎片文件.不必要的或冗余的程序安装等等. 解决方法: 为了解决刚才提到的问题,您可以显著地提高机器的速度.为了修复错误和提高PC速度,建议您下载' mysql .connect .error .internalerror Unread

关于ElasticSearch的聚类时出现fielddata=true问题

https://blog.csdn.net/baristas/article/details/78974090 在ElasticSearch中默认fielddata默认是false的,因为开启Text的fielddata后对内存的占用很高index:megacorptype:employee 如果进行聚合查询时候: GET /megacorp/employee/_search{ "aggs": { "all_interests": { "terms&quo