Elasticsearch5.x版本中对Text类型进行聚合时提示illegal_argument_exception
Having this field in my mapping
"answer": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above":
}
}
},
I try to execute this aggregation
"aggs": {
"answer": {
"terms": {
"field": "answer"
}
},
but I get this error
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [answer] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
得到解决
You need to aggregate on thekeywordsub-field, like this:
"aggs": {
"answer": {
"terms": {
"field": "answer.keyword"
}
},
开始在网上查询解决方案时,有的是修改mapping
1.PUT my_index/_mapping/my_type
{
"properties": {
"my_field": {
"type": "text",
"fielddata": true
}
}
} 或者
2.使用.keyword 推荐
"aggs": {
"answer": {
"terms": {
"field": "answer.keyword"
}
}
Elasticsearch5.x版本中对Text类型进行聚合时提示illegal_argument_exception的更多相关文章
- 数据库表中存在Text类型的属性时,写sql语句时需要注意喽!
之前,习惯性地写查询语句时,查询条件用“=”判断.今天写程序的时候,查询时突然报了一个错误:数据类型text 和varchar 在equal to 运算符中不兼容.查看了一下数据库发现,其中有一个属性 ...
- mybatis 处理 mysql 表中的 text类型的 字段
在mysql 中 text类型的字段: service_detail text NULL 服务描述 . 对应java文件中 model 中的 String: private String ser ...
- ElasticSearch 6.2 Mapping参数说明及text类型字段聚合查询配置
背景: 由于本人使用的是6.0以上的版本es,在使用发现很多中文博客对于mapping参数的说明已过时.ES6.0以后有很多参数变化. 现我根据官网总结mapping最新的参数,希望能对大家有用处. ...
- MYSQL表中设置字段类型为TIMESTAMP时的注意事项
在MYSQL中,TIMESTAMP类型是用来表示日期的,但是和DATETIME不同,不同点就不再这里说明了. 当我们在使用TIMESTAMP类型设置表中的字段时,我们应该要注意一点,首先我们在表中新增 ...
- SpriteBuilder中节点位置类型为百分比时不能定位的解决
Ball.ccb类型是Node,其中有个子节点为Color Node,其中物理使能. MainScene.ccb中加入一个物理节点,将Ball.ccb拖入其中,成为该物理节点的孩子,这时出现了一个&q ...
- 在Eclipse中运行Web项目Jsp网页时提示端口被占用的解决办法:Several ports (8005, 8888, 8009) required by Tomcat v9.0 Server at localhost are already in use.
问题: 在Eclipse中运行Web项目Jsp网页启动Tomcat时提示端口被占用: Several ports (8005, 8080, 8009) required by Tomcat v9.0 ...
- [转]sql中判断text类型字段是否为空
用 字段=''会报错:数据类型 text 和 varchar 在 equal to 运算符中不兼容. 正确方法: 1. 字段 is null 2. datalength(字段)=0 注:SQL中的DA ...
- 在datax之前版本中添加filewriter并创建job时出现问题
问题描述:
- asp.net MVC控制器中返回JSON格式的数据时提示下载
Asp.net mvc在接收的是JSON格式的数据,但是奇怪的是在IE中提示下载文件,其他浏览器中一切正常,下载后,里面的内容就是在控制器中返回的数据.代码如下: 视图中js代码: $("# ...
随机推荐
- leetcode 121. Best Time to Buy and Sell Stock 、122.Best Time to Buy and Sell Stock II 、309. Best Time to Buy and Sell Stock with Cooldown
121. Best Time to Buy and Sell Stock 题目的要求是只买卖一次,买的价格越低,卖的价格越高,肯定收益就越大 遍历整个数组,维护一个当前位置之前最低的买入价格,然后每次 ...
- SSM框架优缺点和spring boot 比起优缺点是什么?
一.SSM优缺点应该分开来说的,比如 1)spring 不说了,核心ioc.aop技术,ioc解耦,使得代码复用,可维护性大幅度提升,aop提供切面编程,同样的增强了生产力. 2)spring mvc ...
- [NOIP2016]换教室(概率期望$DP$)
其实吧我老早就把这题切了--因为说实话,这道题确实不难啊--李云龙:比他娘的状压DP简单多了 今天我翻以前在Luogu上写的题解时,突然发现放错代码了,然后被一堆人\(hack\)--蓝瘦啊\(ORZ ...
- sharepoint OOS打开文档使用新窗口
总体说来就是在<a>标签上嵌入_blank $("a[onclick*='return DispEx'][target!='_blank']") .attr(" ...
- position+left+bottom+top+right
今天才知道原来position加上上下左右可以控制的到div的宽度的 比如我现在有一个需要 这样一个需求 现在是红色部分50px 但是你可能不知道剩下的蓝色部分的高度是多少 蓝色部分要怎么填满剩余的高 ...
- No active profile set, falling back to default profiles: default
No active profile set, falling back to default profiles: default 这个错误是由于idea没有设置默认启动环境,设置即可
- ABAP术语-XML
XML 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/21/1115743.html The "eXtensible Markup ...
- python使用findall正则匹配出所有符合条件的字符串
# -*- coding:utf-8 -*- import re mystr="qqq key:www.baidu.com<br>key:www.tengxun.com<b ...
- 常用PHP方法
个人常用的一些方法记录/** * 返回错误 * * @param int $err_no * @param string $err_msg * @param array $data * @return ...
- Delphi在Android下通过WiFI进行调试
如果我们需要调试USB程序且Android设备只有一个USB口,那么可以通过WiFi来调试程序,这样USB口就可以用了. 大致步骤如下: 1.在有root权限的Android设备里安装“Wifi AD ...