在测试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. matlab神经网络工具箱创建神经网络

    为了看懂师兄的文章中使用的方法,研究了一下神经网络 昨天花了一天的时间查怎么写程序,但是费了半天劲,不能运行,百度知道里倒是有一个,可以运行的,先贴着做标本 % 生成训练样本集 clear all; ...

  2. ubuntu16.04 双网卡绑定

    ubuntu 16.04 双网卡绑定仅仅需要配置/etc/network/interfaces 添加标记内容即可 apt-get install ifenslave 默认已经安装

  3. leetcode812

    class Solution { public: double largestTriangleArea(vector<vector<int>>& points) { d ...

  4. django-model之Q查询补充

    之前我们使用Q查询都是直接将Q对象写死到filter中,例如: 1.查询id大于1并且评论数大于100的书 print(models.Book.objects.filter(Q(nid__gt=1)& ...

  5. java游戏制作之水果忍者

    水果忍者的原理很简单,主要就是采用随机的方式是画面上面出现水果. package Fruitninja; import java.awt.Dimension; import java.awt.Grap ...

  6. windows下安装ubuntu 12.04---利用ubuntu的iso包中的wubi.exe工具安装

    一.下载ubuntu-12.04-desktop-amd64.iso后,用winrar打开,提取出wubi.exe这个文件.把ubuntu-12.04-desktop-amd64.iso和wubi.e ...

  7. Redis搭建(二):主从复制

    一.引言 Redis有三种集群模式: 第一个就是主从模式 第二种“哨兵”模式,在Redis 2.6版本开始提供,2.8版本稳定 第三种是Cluster集群模式,在Redis 3.x以后的版本才增加进来 ...

  8. 【更多教程关注公众号全要买】1-2 Disruptor与BlockingQueue压力测试性能对比

    JDK所提供的BlockingQueue替换成Dis

  9. spring aop自动代理xml配置

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  10. Python 安装urllib3

    一.系统环境 操作系统:Win10 64位 Python版本:Python 3.7.0 二.报错信息 No module named 'urllib3' 三.安装参考 1.参照网上的安装方法通过pip ...