在测试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. Document.location.href和.replace的区别

    转自:https://www.cnblogs.com/GT_Andy/archive/2007/10/31/1922138.html 1 Document.location.href和.replace ...

  2. Logstash安装和设置(图文详解)(多节点的ELK集群安装在一个节点就好)

    前提 Elasticsearch-2.4.3的下载(图文详解) Elasticsearch-2.4.3的单节点安装(多种方式图文详解) Elasticsearch-2.4.3的3节点安装(多种方式图文 ...

  3. OK6410&nbsp;tftp下载内核、文件系…

    飞凌官方提供了一键下载烧写linux的方式,相对来说比较方便,但是对于开发来说不够灵活,因此这篇文章把tftp相关的点介绍一下,整理下其中遇到的一些问题. 一键烧写本质上是启动位于SD卡中的Uboot ...

  4. Write your first jQuery plugin

    本文固定链接: http://www.jquery.org.cn/archives/380 一般来说,jQuery插件的开发分为两种:一种是挂在jQuery命名空间下的全局函数,也可称为静态方法:另一 ...

  5. iis8不支持 aspnet_regiis.exe -iru 命令的解决办法

    服务器版的限制,我看你给的提示说也可以使用 dism.exe 命令行. C:\> DISM /Online /Enable-Feature /FeatureName:WCF-HTTP-Activ ...

  6. IDEA03 连接数据库、自动生成实体类

    1 版本说明 JDK:1.8 MAVEN:3.5 SpringBoot:2.0.4 IDEA:旗舰版207.2 MySQL:5.5 2 利用IDEA连接数据库 说明:本案例以MySQL为例 2.1 打 ...

  7. Deepin 2014.2正式版发布 - 自由·独特·前卫

    感谢 deepin 的投递 deepin致力于为全球用户提供美观易用.安全可靠的Linux系统. deepin系统使用基于HTML5技术开发的深度桌面环境,搭配深度音乐.深度影院.WPS和搜狗输入法等 ...

  8. 框架和cms区别

    cms:精装房,拎包即可入住 框架:毛坯房,内部装修可根据自己需求来 选择策略:个性化需求不高的话,可以选择cms

  9. hdu 2206 IP的计算(最全的注意事项)

    注意: 1.非法字符(包括空格) 如下都是错的 A.145.124.4 192.168.18 123(用scanf输入的话,则接收的是:192.168.18) 2.'.'有且仅有3个,且不能连续出现, ...

  10. win7桌面鼠标右键过慢的解决方案

    由于Intel显卡驱动在桌面右键的加载项造成.解决方案:清理注册表中桌面右键加载项,点击开始,输入regedit,找到HKEY_CLASSES_ROOT\Directory\Background\sh ...