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进行如下聚合操作时,会报如题所示错误:
➜ Downloads curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
"size": 0,
"aggs": {
"group_by_state": {
"terms": {
"field": "state"
}
}
}
}'
提示报错如下:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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" : "bank",
"node" : "nkL8C69pTMuXrZBXicjshw",
"reason" : {
"type" : "illegal_argument_exception",
"reason" : "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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 [state] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
}
},
"status" : 400
}
根据官方文档显示,出现该错误是因为5.x之后,Elasticsearch对排序、聚合所依据的字段用单独的数据结构(fielddata)缓存到内存里了,但是在text字段上默认是禁用的,如果有需要单独开启,这样做的目的是为了节省内存空间。——官方文档地址:https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html
开启方法:
➜ Downloads curl -XPUT 'http://localhost:9200/bank/_mapping/account' -d '
{
"properties": {
"state": {
"type": "text",
"fielddata": true
}
}
}'
# bank是index、account是类型、state是你需要设置的text字段
出现如下提示,说明设置成功:
{"acknowledged":true}
至此,聚合问题解决:
➜ Downloads curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
"size": 0,
"aggs": {
"group_by_state": {
"terms": {
"field": "state"
}
}
}
}'
{
"took" : 60,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1000,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"group_by_state" : {
"doc_count_error_upper_bound" : 20,
"sum_other_doc_count" : 770,
"buckets" : [
{
"key" : "id",
"doc_count" : 27
},
{
"key" : "tx",
"doc_count" : 27
},
{
"key" : "al",
"doc_count" : 25
},
{
"key" : "md",
"doc_count" : 25
},
{
"key" : "tn",
"doc_count" : 23
},
{
"key" : "ma",
"doc_count" : 21
},
{
"key" : "nc",
"doc_count" : 21
},
{
"key" : "nd",
"doc_count" : 21
},
{
"key" : "me",
"doc_count" : 20
},
{
"key" : "mo",
"doc_count" : 20
}
]
}
}
}
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进行聚合操作时提示Fielddata is disabled on text fields by default
原文地址:http://blog.csdn.net/u011403655/article/details/71107415 根据es官网的文档执行 GET /megacorp/employee/_se ...
- (转)es进行聚合操作时提示Fielddata is disabled on text fields by default
根据es官网的文档执行 GET /megacorp/employee/_search { "aggs": { "all_interests": { " ...
- Kibana创建索引成功,但一直不显示出来(Fielddata is disabled on text fields by default. Set fielddata=true........)
现象 把EFK整个集群搭建完成后,通过Kibana操作界面创建索引(如图1),我创建了lile-zabbix*的索引,显示是创建成功了,但是只要我在重新刷新一次,已经创建的索引就“消失了”.后通过查看 ...
- 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_fi ...
- Elasticsearch 6.2.3版本 string 类型字段 排序 报错 Fielddata is disabled on text fields by default
背景说明 最近在做一个 Elasticsearch 的分页查询,并且对查询结果按照特定字段进行排序的功能. 但是执行结果却报错,报错信息如下: { "error": { " ...
- Elasticsearch 6.2.3版本 执行聚合报错 Fielddata is disabled on text fields by default
背景说明 执行<Elasticsearch 权威指南>的示例,在执行聚合查询的时候,报错 Fielddata is disabled on text fields by default. ...
- elasticsearch报Fielddata is disabled on text fields by default
我刚玩elk没几天,今天启动kibana之后执行查询看见elasticsearch报了一个错误 Caused by: java.lang.IllegalArgumentException: Field ...
- 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 cardina ...
- Fielddata is disabled on text fields by default Set fielddata=true on [service.address]
2个字段的: PUT metricbeat-7.3.0/_mapping { "properties": { "service": { "proper ...
随机推荐
- win10 uwp 打开文件管理器选择文件
本文:让文件管理器选择文件,不是从文件管理器获得文件. 假如已经获得一些文件,那么如何从文件管理器选择这些文件? 使用方法很简单. 从网上拿图来说 打开文件夹自动选择所有文件 首先需要获得文件夹,因为 ...
- Caused by: java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required
概述 看到异常 一般就知道 在使用JdbcTemplate 需要购入数据源, 购入数据源的方式有两种,一种是xml 配置 在DAO层注入数据源, 另一种是在xml 中 配置模版JdbcTemplate ...
- 记录一个Unity播放器插件的开发
背景 公司最近在做VR直播平台,VR开发我们用到了Unity,而在Unity中播放视频就需要一款视频插件,我们调研了几个视频插件,记录两个,如下: Unity视频插件调研 网上搜了搜,最流行的有以下两 ...
- LeetCode 189. Rotate Array (旋转数组)
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array ...
- Spring MVC 快捷定义 ViewController
WHY : 为什么我们需要快捷定义 ViewController ? 在项目开发过程中,经常会涉及页面跳转问题,而且这个页面跳转没有任何业务逻辑过程,只是单纯的路由过程 ...
- bug:未考虑实际使用场景
最近bug比较多,汗颜. 1.需求背景 (1)app活动页面,用户参与并完成能够以1分钱价格购买指定商品(2)这个页面可分享至app以外的渠道,如微信.QQ等 2.这个bug的表现形式:用户在第三方渠 ...
- Ionic3 打包并签名Android-App
ionic cordova build android --prod --release 此时,在项目根目录中看下看到生成的apk文件:platforms\android\build\outputs\ ...
- java语言在某个数组中查找某个字符出现的次数
package com.llh.demo; import java.util.Scanner; /** * * @author llh * */ public class Test { /* * 在某 ...
- SAXReader简单实例解析HTML
转载自:http://blog.csdn.net/seayqrain/article/details/5024068# 使用SAXReader需要导入dom4j-full.jar包. dom4j是一个 ...
- JavaScript--我发现,原来你是这样的JS:面向对象编程OOP[2]--(创建你的那个对象吧)
一.介绍 我们继续面向对象吧,这次是面向对象编程的第二篇,主要是讲创建对象的模式,希望大家能从博客中学到东西. 时间过得很快,还是不断的学习吧,为了自己的目标. 二.创建对象 1.前面的创建对象方式 ...