我的索引上有这种映射类型。
{
"iotsens-summarizedmeasures": {
"mappings": {
"summarizedmeasure": {
"properties": {
"id": {
"type": "long"
},
"location": {
"type": "boolean"
},
"rawValue": {
"type": "string"
},
"sensorId": {
"type": "string"
},
"summaryTimeUnit": {
"type": "string"
},
"timestamp": {
"type": "date",
"format": "dateOptionalTime"
},
"value": {
"type": "string"
},
"variableName": {
"type": "string"
}
}
}
}
}
}
我想将sensorId
字段更新为。
"sensorId": {
"type": "string",
"index": "not_analyzed"
}
有没有办法更新索引而不删除并重新映射?我不必更改字段类型,我只设置"index": "not_analyzed"
。
谢谢你。
答案 0 :(得分:0)
您可以做的是使用名为sensorId
的{{1}}子字段raw
从现有的not_analyzed
字段中multi-field生成Gimp.org:
curl -XPUT localhost:9200/iotsens-summarizedmeasures/_mapping/summarizedmeasure -d '{
"summarizedmeasure": {
"properties": {
"sensorId": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}'
但是,您仍需要重新编制数据索引,以确保创建所有sensorId.raw
个子字段。