ES聚合报错
在测试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聚合报错的更多相关文章
- Springboot集成ES启动报错
		报错内容 None of the configured nodes are available elasticsearch.yml配置 cluster.name: fans node.name: no ... 
- Elasticsearch 6.2.3版本 执行聚合报错 Fielddata is disabled on text fields by default
		背景说明 执行<Elasticsearch 权威指南>的示例,在执行聚合查询的时候,报错 Fielddata is disabled on text fields by default. ... 
- MongoDb 聚合报错
		聚合框架它是数据聚合的一个新框架,其概念类似于数据处理的管道. 每个文档通过一个由多个节点组成的管道,每个节点有自己特殊的功能(分组.过滤等),文档经过管道处理后,最后输出相应的结果. 管道基本的功能 ... 
- ES部署报错 max file size 和 kibana 报错File size limit exceeded
		启动失败一 ERROR: [2] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process ... 
- ES启动报错之引导检测失败
		[--16T18::,][ERROR][o.e.b.Bootstrap ] [node-] node validation exception [] bootstrap checks failed [ ... 
- ES启动报错最大进程数太少
		[--16T18::,][INFO ][o.e.b.BootstrapChecks ] [node-] bound or publishing to a non-loopback address, e ... 
- es 启动报错 内存太小
		max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] elastics ... 
- 【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 ... 
- python:rs, ws, es = select.select(inputs, [], []) --报错error 10022
		昨晚折腾的1个多钟,直到3点多才睡,感觉自己也是热爱代码了,敲3个多钟一点也不累(其实是为了凌晨6点起来抢票回家了^_^) 练习python中select进行异步通信-防止socket.recv方法阻 ... 
随机推荐
- ubuntu 14.04使用root登陆出现错误“Error found when loading /root/.profile”解决
			在刚修改完root权限自动登录后,发现开机出现以下提示: Error found when loading /root/.profile stdin:is not a tty ----........ ... 
- 关系数据库元组关系演算语言ALPHA
			关系演算 :以数理逻辑中的谓词演算为基础 按谓词变元不同分类 1.元组关系演算:以元组变量作为谓词变元的基本对象元组关系演算语言ALPHA2.域关系演算:以域变量作为谓词变元的基本对象域关系演算语言Q ... 
- 如何规避javascript多人开发函数重名问题
			命名空间 封闭空间 js模块化mvc(数据层.表现层.控制层) seajs(如果了解的呢,可以说) 变量转换成对象的属性 对象化 
- 用一两句话说一下你对“盒模型”这个概念的理解,和它都涉及到哪些css属性
			网页设计中常听的属性名:内容(content).填充(padding).边框(border).边界(margin), CSS盒子模式都具备这些属性. 这些属性我们可以用日常生活中的常见事物——盒子作一 ... 
- IDA Pro 权威指南学习笔记(四) - IDA 用户界面的基本规则
			基本规则: IDA 不提供撤销功能 如果由于不小心按下某个键,导致数据库文件发生意外,这时需要将显示窗口恢复到以前的状态 几乎所有的操作都有其对应的菜单项.热键和工具栏按钮 IDA 的工具栏高度可配置 ... 
- **python中列表 元组 字典 集合
			列表 元组 字典 集合的区别是python面试中最常见的一个问题.这个问题虽然很基础,但确实能反映出面试者的基础水平. 1.列表 列表是以方括号“[]”包围的数据集合,不同成员以“,”分隔. 列表的特 ... 
- Windows下Git中正确显示中文的设置方法
			Windows下Git中正确显示中文的设置方法 具体设置方法如下: 进入目录etc:$ cd /etc 1. 编辑 gitconfig 文件:$ vi gitconfig.在其中增加如下内容: [gu ... 
- UIRect中的Anchor组件
			[UIRect中的Anchor组件] Anchor用于实现粘着功能,寄存于UIRect类中.Anchor的类型有三种: 1.None:不使用跟随功能. 2.Unified:四条边使用相同的Target ... 
- Gym-101128D:Dice Cup
			题意 给你两个骰子,一个有n面,一个有m面,分别仍一次,求和的概率最大的值 分析 签到题 模拟就行 凑数才把这个题也发到博客上···· #include <cstdio> #include ... 
- php+mysql网站无限级栏目分类-递归获取树形结构函数
			如果网站采用了无限级栏目结构,我们可以将网站所有栏目获取出来组成一个树形结构.数据库结构: 函数代码: //获得指定文章分类的子分类组成的树形结构 function cateTree($pid=0,$ ... 
