我想将字段的类型从“字符串”更改为“日期”(具体格式:“epoch_second”)。由于无法更新现有索引的映射,我需要创建一个新索引,我最想使用现有索引中的映射。这是我正在使用的:
curl -XGET ' http://localhost:9200/sam/saga/_mapping?pretty ' >saga.json
将当前索引的映射转储到一个 json 文件中,其内容是这样的:
{
"sam" : {
"mappings" : {
"saga" : {
"properties" : {
"name" : {
"type" : "long"
}
}
}
}
}
}
然后我替换
"name" : {
"type" : "long"
}
和
"name" : {
"type" : "date"
}
并将新文件保存为 saga2.json。然后运行这个
curl -XPUT ' http://localhost:9200/sam/_mapping/saga2 ' -d @saga2.json
但是,当我检查新索引的映射时,现在所有类型都更改为“字符串”。
我什至在使用 Elasticsearch 的示例时遇到了这个问题。
有谁知道出了什么问题?