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"
      }
    }
  }
}

 

上一篇:解决MFC多个对话框之间数据交换问题


下一篇:传统IDC 部署网站