代码之家  ›  专栏  ›  技术社区  ›  Parminder Singh

在CURL[duplicate]中,默认情况下,在文本字段上禁用获取错误字段数据

  •  4
  • Parminder Singh  · 技术社区  · 7 年前

    我试过这个命令:

    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
    

    我该怎么解决?

    1 回复  |  直到 7 年前
        1
  •  4
  •   dadoonet    5 年前

    更改映射和重新索引

    keyword 类型或 text 键入 fielddata: true