【问题标题】:Getting the error Fielddata is disabled on text fields by default in CURL [duplicate]默认情况下,在 CURL 中,文本字段上的错误字段数据被禁用 [重复]
【发布时间】:2018-04-02 21:53:23
【问题描述】:

我试过这个命令:

curl -XPOST 'localhost:9200/bank/_search?pretty' -d ' { "size": 0, "aggs": { "group_by_state": { "terms": { "field": "state" } } } }'

当我执行它时,我总是在 elasticSearch 中得到这个错误:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Fielddata is disabled on text fields by default. Set   fielddata=true on [state] 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" : "bank",
        "node" : "B8uNFSm7TzO9KS3N72EFPg",
        "reason" : {
          "type" : "illegal_argument_exception",
          "reason" : "Fielddata is disabled on text fields by default. Set fielddata=true on [state] 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."
    `enter code here`    }
      }
    ]
  },
  "status" : 400
}enter code here

我该如何解决?

【问题讨论】:

标签: java curl elasticsearch elasticsearch-plugin spring-data-elasticsearch


【解决方案1】:

更改您的映射并重新索引

使用keyword 类型或text 类型与fielddata: true

【讨论】:

  • 我没有听到你说“使用关键字类型或带有字段数据的文本:true”
  • 请问你可以通过任何运行示例或任何链接来展示这个吗?
猜你喜欢
  • 2023-03-30
  • 2018-03-08
  • 2017-05-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多