ElasticSearc创建索引报错:“root_cause“: [ { “type“: “resource_already_exists_ex

ElasticSearc创建索引报错:

{
     
    "error": {
     
        "root_cause": [
            {
     
                "type": "resource_already_exists_exception",
                "reason": "index [shopping/rOncXIsQQjacZrKHNvDp8w] already exists",
                "index_uuid": "rOncXIsQQjacZrKHNvDp8w",
                "index": "shopping"
            }
        ],
        "type": "resource_already_exists_exception",
        "reason": "index [shopping/rOncXIsQQjacZrKHNvDp8w] already exists",
        "index_uuid": "rOncXIsQQjacZrKHNvDp8w",
        "index": "shopping"
    },
    "status": 400
}

postman中报错:
ElasticSearc创建索引报错:“root_cause“: [ { “type“: “resource_already_exists_ex_第1张图片
可以参考:https://discuss.elastic.co/t/put-mapping-fails-index-already-exists-exception/56782
查看所有创建的索引(GET请求):

http://127.0.0.1:9200/_cat/indices?v

ElasticSearc创建索引报错:“root_cause“: [ { “type“: “resource_already_exists_ex_第2张图片

解决方案: 删掉index,重新创建index。
删除索引(DELETE请求):

http://127.0.0.1:9200/shopping

ElasticSearc创建索引报错:“root_cause“: [ { “type“: “resource_already_exists_ex_第3张图片

{
       
"acknowledged"【响应结果】: true,  # true 操作成功  
"shards_acknowledged"【分片结果】: true, # 分片操作成功  
"index"【索引名称】: "shopping" 
}

注意:创建索引库的分片数默认 1 片,在 7.0.0 之前的 Elasticsearch 版本中,默认 5 片

如果重复添加索引,会返回错误信息。

PUT具有幂等性!
第一次创建成功后,再去创建相同的就会出现问题!

ElasticSearc创建索引报错:“root_cause“: [ { “type“: “resource_already_exists_ex_第4张图片
如图所示,即为索引创建成功!

你可能感兴趣的:(记录报错解决办法,postman,elasticsearch)