首页 > 解决方案 > 在 Elasticsearch 中更改映射字段结构流程

问题描述

我有一个映射索引

{
   "mappings": {
      "properties": {
         "title": {
            "type": "text"
         },
         "location": {
            "type": "keyword"
         }
      }
   }
}

目前在location字段中,我们正在存储城市名称。我们需要改变映射结构来存储国家和州,所以映射将是

{
   "mappings": {
      "properties": {
         "title": {
            "type": "text"
         },
         "location": {
            "properties": {
                "country": {
                    "type": "keyword"
                },
                "state": {
                    "type": "keyword"
                },
                "city": {
                    "type": "keyword"
                }
            }
         }
      }
   }
}

这种迁移的推荐流程是什么?

标签: elasticsearchelasticsearch-java-apielasticsearch-mapping

解决方案



推荐阅读