创建索引映射时找不到分析器

Vik*_*dya 1 elasticsearch

analyzer_keyword创建索引时添加了新的分析器- 请参阅下面的create index

curl -XPUT 'http://mycluster/dsi2' -d '{
  "settings": {
    "index": {
      "number_of_shards": 1,
      "number_of_replicas": 1,
      "analysis": {
        "analyzer": {
          "analyzer_keyword": {
            "tokenizer": "keyword",
             "filter": "lowercase"
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

运行_settings端点确认以下内容

http GET http://mycluster/dsi2/_settings
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 267
Content-Type: application/json; charset=UTF-8

{
    "dsi2": {
        "settings": {
            "index": {
                "analysis": {
                    "analyzer": {
                        "analyzer_keyword": {
                            "filter": "lowercase", 
                            "tokenizer": "keyword"
                        }
                    }
                }, 
                "creation_date": "1484088347598", 
                "number_of_replicas": "1", 
                "number_of_shards": "1", 
                "uuid": "Lu98fn6gRiOe3Q1y8fU6tQ", 
                "version": {
                    "created": "2030299"
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但现在在创建时mapping- (以下是与相关字段的部分映射json)

curl -XPUT 'http://mycluster/_mapping/dsi2' -d '{
  "_all": {
    "enabled": true
  },
  "properties": {
    "mainId" : {
      "type" : "integer"
      },

    "instance": {
      "properties": {
        "id": {
          "type": "integer",
          "fields": {
            "raw": {
              "type": "integer",
              "index": "not_analyzed"
            }
Run Code Online (Sandbox Code Playgroud)

它抛出

[{"error":{"root_cause": [{"type":"mapper_parsing_exception","reason":"analyzer [analyzer_keyword] not found for field [raw]"}],"type":"mapper_parsing_exception","reason":"analyzer [analyzer_keyword] not found for field [raw]"},"status":400}
Run Code Online (Sandbox Code Playgroud)

任何想法为什么它无法找到analyzer_keyword创建索引的一部分的映射?这是针对Elastic版本2.3的Amazon EC2 ElasticService实例

编辑 - 感谢Val的回应.

@Val - 感谢您的回复.在你指出重新创建索引之后 - 我在创建映射时仍然遇到相同的错误.当我运行GET时http://mycluster/dsi2/_settings它会向我显示以下内容

{
    "dsi2": {
        "settings": {
            "index": {
                "analysis": {
                    "analyzer": {
                        "analyzer_keyword": {
                            "filter": "lowercase", 
                            "tokenizer": "keyword"
                        }
                    }
                }, 
                "creation_date": "1484146006348", 
                "number_of_replicas": "1", 
                "number_of_shards": "1", 
                "uuid": "HzjQjZXmS8SPF6yUFZanEQ", 
                "version": {
                    "created": "2030299"
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Val*_*Val 5

这是因为该analysis部分直接进入settings而不进行settings > index.

您可以像这样重新创建索引,它将起作用:

curl -XPUT 'http://mycluster/dsi2' -d '{
  "settings": {
    "index": {
      "number_of_shards": 1,
      "number_of_replicas": 1
    },
    "analysis": {
      "analyzer": {
        "analyzer_keyword": {
          "tokenizer": "keyword",
          "filter": "lowercase"
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)