原文地址:http://blog.csdn.net/u011403655/article/details/71107415

根据es官网的文档执行

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."
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "megacorp",
"node": "-Md3f007Q3G6HtdnkXoRiA",
"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."
}
}
],
"caused_by": {
"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."
}
},
"status": 400
}

搜了一下应该是5.x后对排序,聚合这些操作用单独的数据结构(fielddata)缓存到内存里了,需要单独开启,官方解释在此fielddata(https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html)

简单来说就是在聚合前执行如下操作

PUT megacorp/_mapping/employee/
{
"properties": {
"interests": {
"type": "text",
"fielddata": true
}
}
}

最新文章

  1. C#4.0 特性
  2. Win7常规快捷键
  3. Linux下控制器IO地址
  4. 解惑:NFC手机如何轻松读取银行卡信息?
  5. sphinx下的max_matches取值对SetLimits的影响
  6. java二维码生成与解析代码实现
  7. 【leetcode】Divide Two Integers (middle)☆
  8. 【译】typeof null的前世今生
  9. hdu 5363Key Set
  10. RedHat Enterprise Linux 6.3 安装Oracle Database 11g
  11. ReactJs入门思路
  12. css3选择器:nth-child和nth-of-type之间的差别
  13. 【Git】 自动化Maven项目构建脚本(二)
  14. tf.train.ExponentialMovingAverage
  15. 对比剖析Swarm Kubernetes Marathon编排引擎
  16. 小妖精的完美游戏教室——东方PROJECT,同人,子机
  17. display: table-cell的实用应用
  18. 题解-bzoj4061 CERC-2012Farm and Factory
  19. react添加样式的四种方法
  20. c# 数据结构 ArrayList

热门文章

  1. Python处理微信利器——itchat
  2. 第26章:MongoDB-索引
  3. 添加网络ADB的方法(含以太网和无线)
  4. AngularJS实战之路由ui-view传参
  5. 笔记:CSS hack的学习与了解…
  6. (转)WCF中神秘的“8733"端口和“Design_Time_Addresses”
  7. la3890(半平面交)
  8. Java理论学时第三节。课后作业。
  9. 2.panel面板
  10. Implementation of WC in JAVA