elasticsearch对text类型进行聚合时遇到的问题

在elasticsearch中对数据进行聚合,想得出每个来源的数据量,mapping: "news_source": {"type": "text"},"related_

在elasticsearch中对数据进行聚合,想得出每个来源的数据量,mapping:

  "news_source": {
   
   
     "type": "text"
   },
   "related_freq": {
   
   
     "type": "integer"
   },

查询条件:

GET /event_news/_search
{
  "size": 0, 
  "aggs": {
    "news_source_info":{
      "terms": {
        "field": "news_source"
      },
      "aggs": {
        "total_sum": {
          "sum": {"field": "related_freq"}
        }
      }
    }
  }
}

结果报错

{
   
   
  "error": {
   
   
    "root_cause": [
      {
   
   
        "type": "illegal_argument_exception",
        "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [news_abstract] 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": "event_news",
        "node"

发布者:admin,转转请注明出处:http://www.yc00.com/web/1754939077a5217834.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信