我有下面的映射-
{
"mappings": {
"my_type": {
"properties": {
"status": {
"type": "text",
"fields": {
"code": {
"type": "keyword"
}
}
}
}
}
}
}
我想为状态和代码设置值,例如-
status - CRITICAL
status.code - 10
我该怎么办?
最佳答案
你不能那样做。您需要使用object
类型而不是多字段
{
"mappings": {
"my_type": {
"properties": {
"status": {
"type": "object",
"properties": {
"name": {
"type": "keyword"
},
"code": {
"type": "integer"
}
}
}
}
}
}
}
然后您就可以设置
status.name - CRITICAL
status.code - 10
关于elasticsearch - 如何在Elasticsearch中设置多字段值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43936676/