其他分享
首页 > 其他分享> > Elasticsearch聚合操作报错解决办法

Elasticsearch聚合操作报错解决办法

作者:互联网

1. 当根据一个类型为text的字段idc进行聚合操作时,查询语句如下:

{
  "aggs": {
    "top_10_states": {
      "terms": {
        "field": "idc"
      }
    }
  }
}

 

会报错:

"Fielddata is disabled on text fields by default. Set fielddata=true on [idc] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."

解决办法,在构建查询语句时,给字段添加.keyword即可解决:

{
  "aggs": {
    "top_10_states": {
      "terms": {
        "field": "idc.keyword"
      }
    }
  }
}

 

标签:解决办法,fielddata,text,top,field,Elasticsearch,报错,idc
来源: https://www.cnblogs.com/wt11/p/11095266.html