我是elasticsearch的新手。我使用这样的代码创建一个映射:
PUT /my-demo1
{
"mappings": {
"properties": {
"dsu_sn": {
"type": "keyword"
},
"iot_id": {
"type": "keyword"
},
"test_suite_id": {
"type": "text"
},
"error_code": {
"type": "long"
}
}
}
}
ES 回复 mapper [iot_id] cannot be changed from type [keyword] to [text]
当我使用这样的代码索引文档时:POST /my-demo1/1
{
"dsu_sn": "ssl123321",
"iot_id": "550068573720395776",
"test_suite_id": "com.example.test.wifi",
"error_code": 2
}
最佳答案
您需要添加 _doc
在将文档发布到 Elasticsearch 时的 URL 中,将 URL 更改为 POST /my-demo1/_doc/1
引用 removal of types了解更多信息。
关于elasticsearch-7.9.0 无法从类型 [keyword] 更改为 [text],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65031413/