在测试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. oracle中,约束、表名、Index等的名称长度限制最大只能30个字符

    oracle中,约束.表名.Index等的名称长度限制最大只能30个字符

  2. 简单的HTTP服务实现

    最近因工作需要为外部公司提供http服务,由于内容比较少,同时为了方便安装,就想着自己写一个简单的服务器. 思路是将一个Http服务器嵌入一个Windows Service程序中,于是在网上找了很多资 ...

  3. HTML5+ 初识,HBuilder,夜神模拟器,Webview

    一.HTML5+ 初识 HTML5 Plus应用概述 HTML5 Plus移动App,简称5+App,是一种基于HTML.JS.CSS编写的运行于手机端的App,这种App可以通过扩展的JS API任 ...

  4. Rest Framework 认证源码流程

    一.请求到来之后,都要先执行dispatch方法,dispatch方法方法根据请求方式的不同触发get/post/put/delete等方法 注意,APIView中的dispatch方法有很多的功能 ...

  5. Java面向对象-package import关键字

    Java面向对象-package import关键字 package包关键字,在java中,有包的概念,主要是用来归类 分类作用: 便于项目的开发和维护: 这里截取随便截取一个我最近在开发的一个开源工 ...

  6. 使用Selenium登录新浪微博

    为了总结一下Selenium的用法,具体用了这个例子来说明一下. Selenium简单来说,就是通过程序驱动一个浏览器,并且可以通过程序来帮你做一些事情,例如点击.填表呀之类的. 换句话说,你在浏览器 ...

  7. java基础知识(三)之数组

    声明数组: 语法:数据类型[ ] 数组名://例:int[ ] scores;  或者 数据类型 数组名[ ]://例:int scores[ ];分配空间 语法:数组名 = new 数据类型 [ 数 ...

  8. 深入剖析SolrCloud(一)

    作者:洞庭散人 出处:http://phinecos.cnblogs.com/ 本博客遵从Creative Commons Attribution 3.0 License,若用于非商业目的,您可以自由 ...

  9. 【bzoj2186】[Sdoi2008]沙拉公主的困惑

    2186: [Sdoi2008]沙拉公主的困惑 Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 3303  Solved: 1129[Submit][S ...

  10. Build Path

    ------------siwuxie095 什么是 Build Path? 为什么使用 Build Path? 如: (1)创建一个Java工程:LearnBuildPath (2)点击 Next, ...