我对弹性有这个问题。我希望对索引的部分进行动态和静态映射。
我进行了以下映射:
{"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"dynamic": false,
"date_detection": false,
"properties": {
"id": {
"type": "keyword"
},
"metadata": {
"dynamic": false,
"properties": {
"time": {
"properties": {
"insert": {
"type": "date"
}
}
}
}
},
"traits": {
"properties": {
"private": {
"dynamic": true
},
"public": {
"dynamic": true
}
}
}
}
}
}我得到以下错误:
未能解析映射_doc:未为字段私有指定任何类型
我错过了什么。我希望索引的traits.private部分是动态的,这样用户就可以添加任何数据。
是有弹性的事件还是我遗漏了什么?
发布于 2021-09-07 07:31:15
这是可能的,但是您得到的错误消息是因为您还没有为private和public定义private类型。如果这样做,则可以成功地创建索引:
PUT test
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"dynamic": false,
"date_detection": false,
"properties": {
"id": {
"type": "keyword"
},
"metadata": {
"dynamic": false,
"properties": {
"time": {
"properties": {
"insert": {
"type": "date"
}
}
}
}
},
"traits": {
"properties": {
"private": {
"type": "object", <--- add this
"dynamic": true
},
"public": {
"type": "object", <--- add this
"dynamic": true
}
}
}
}
}
}https://stackoverflow.com/questions/69083949
复制相似问题