在测试Elasticsearch聚合的时候报了一个错误。具体如下:

GET /megacorp/employee/_search
{
"aggs": {
"all_interests": {
"terms": { "field": "interests" }
}
}
}

报错信息

{
"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. Alternatively use a keyword field instead."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "megacorp",
"node": "wlvuJ0f_SsCxys6ZW5j7eA",
"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. Alternatively use a keyword field instead."
}
}
]
},
"status": 400
}

此时需要使用.keyword即可满足,如下

GET /megacorp/employee/_search
{
"aggs": {
"all_interests": {
"terms": { "field": "interests.keyword" }
}
}
}

结果如下

{
"took": ,
"timed_out": false,
"_shards": {
"total": ,
"successful": ,
"skipped": ,
"failed":
},
"hits": {
"total": ,
"max_score": ,
"hits": [
{
"_index": "megacorp",
"_type": "employee",
"_id": "",
"_score": ,
"_source": {
"first_name": "Jane",
"last_name": "Smith",
"age": ,
"about": "I like to collect rock albums",
"interests": [
"music"
]
}
},
{
"_index": "megacorp",
"_type": "employee",
"_id": "",
"_score": ,
"_source": {
"first_name": "John",
"last_name": "Smith",
"age": ,
"about": "I love to go rock climbing",
"interests": [
"sports",
"music"
]
}
},
{
"_index": "megacorp",
"_type": "employee",
"_id": "",
"_score": ,
"_source": {
"first_name": "Douglas",
"last_name": "Fir",
"age": ,
"about": "I like to build cabinets",
"interests": [
"forestry"
]
}
}
]
},
"aggregations": {
"all_interests": {
"doc_count_error_upper_bound": ,
"sum_other_doc_count": ,
"buckets": [
{
"key": "music",
"doc_count":
},
{
"key": "forestry",
"doc_count":
},
{
"key": "sports",
"doc_count":
}
]
}
}
}

ES聚合报错的更多相关文章

  1. Springboot集成ES启动报错

    报错内容 None of the configured nodes are available elasticsearch.yml配置 cluster.name: fans node.name: no ...

  2. Elasticsearch 6.2.3版本 执行聚合报错 Fielddata is disabled on text fields by default

    背景说明 执行<Elasticsearch 权威指南>的示例,在执行聚合查询的时候,报错 Fielddata is disabled on text fields by default. ...

  3. MongoDb 聚合报错

    聚合框架它是数据聚合的一个新框架,其概念类似于数据处理的管道. 每个文档通过一个由多个节点组成的管道,每个节点有自己特殊的功能(分组.过滤等),文档经过管道处理后,最后输出相应的结果. 管道基本的功能 ...

  4. ES部署报错 max file size 和 kibana 报错File size limit exceeded

    启动失败一 ERROR: [2] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process ...

  5. ES启动报错之引导检测失败

    [--16T18::,][ERROR][o.e.b.Bootstrap ] [node-] node validation exception [] bootstrap checks failed [ ...

  6. ES启动报错最大进程数太少

    [--16T18::,][INFO ][o.e.b.BootstrapChecks ] [node-] bound or publishing to a non-loopback address, e ...

  7. es 启动报错 内存太小

    max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] elastics ...

  8. 【Elasticsearch】ES中时间查询报错:Caused by: ElasticsearchParseException[failed to parse date field [Sun Dec 31 16:00:00 UTC 2017] with format [yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis]];

    ES中时间查询报错:Caused by: ElasticsearchParseException[failed to parse date field [Sun Dec 31 16:00:00 UTC ...

  9. python:rs, ws, es = select.select(inputs, [], []) --报错error 10022

    昨晚折腾的1个多钟,直到3点多才睡,感觉自己也是热爱代码了,敲3个多钟一点也不累(其实是为了凌晨6点起来抢票回家了^_^) 练习python中select进行异步通信-防止socket.recv方法阻 ...

随机推荐

  1. blockground

    颜色的表示方法 一共有三种:单词.rgb表示法.十六进制表示法 rgb:红色 绿色 蓝色 三原色光学显示器,每个像素都是由三原色的发光原件组成的,靠明亮度不同调成不同的颜色的.用逗号隔开,r.g.b的 ...

  2. Java字节码

    Java字节码 javap -c 反编译.class文件可得字节码 知乎讨论https://www.zhihu.com/question/27831730 栈和局部变量操作 将常量压入栈的指令 aco ...

  3. 【282】◀▶ arcpy.mapping 常用函数说明

    arcpy.mapping 教程入门 arcpy.mapping 指导原则 按字母顺序排序的 arcpy.mpping 类列表 按字母顺序排序的 arcpy.mpping 函数列表 按字母顺序排序的 ...

  4. PyCharm设置Ipython交互环境和宏快捷键进行数据分析图文详解

    使用Python进行数据分析,大家都会多少学习一本经典教材<利用Python进行数据分析>,书中作者使用了Ipython的交互环境进行了书中所有代码的案例演示,而书中的Ipython交互环 ...

  5. java Web jsp嵌入代码的三种方式

    1,表达式标签  <%= 2+3%> 唯一有显示功能的标签 作用: 计算表达式的返回值 将表达式的返回值显示到网页中. 注意: 表达式中不能有分号 2,普通脚本标签  <% %> ...

  6. 【原创】10. MYSQL++ 之 DbDriver

    1. 综述 DbDriver只是对于MYSQL C API的一个非常简单的封装,作者原句是This class does as little as possible to adapt between ...

  7. 有关Lucene的问题(4):影响Lucene对文档打分的四种方式

    原文出自:http://forfuture1978.iteye.com/blog/591804点击打开链接 在索引阶段设置Document Boost和Field Boost,存储在(.nrm)文件中 ...

  8. opennebula image单个实例响应数据格式

    { ", ", ", "TEMPLATE": { "DEV_PREFIX": "hd", " }, ...

  9. PHP数组的详细解读

    数组的定义 数组的本质是管理和操作一组变量,数组中可以存储任意长度的数据,也可以存储任意类型的数据.数组中的单元称为元素,每个元素包括下标(键)和值,访问元素的时候,是通过下标来访问,包括一维数组,二 ...

  10. bzoj5392 [Lydsy1806月赛]路径统计

    传送门 分析 我们设sum[x]为小于等于x的点现在有多少联通 于是一个序列合法当且只当sum[R]-sum[L-1]=len且所有点度数不大于2 我们知道如果对于序列[L,R]满足条件则[L+1,R ...