我创建了一个索引
{
"user": {
"mappings": {
"_doc": {
"_all": {
"enabled": false
},
"properties": {
"name": {
"store": true,
"type": "keyword"
},
"child": {
"type": "nested",
"properties": {
"age": {
"store": true,
"type": "integer"
},
"gender": {
"store": true,
"type": "integer"
}
}
}
}
}
}
}
}
并添加文档
{
"name":"jack",
"child":[
{
"age":0,
"gender":1
}
]
}
当我执行查询时
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "child",
"ignore_unmapped":true,
"query": {
"bool": {
"must": [
{
"term": {
"child.age": 0
}
}
]
}
}
}
}
]
}
}
}
总是返回这个错误:
未能创建查询:路径[子]下的[嵌套]嵌套对象不是嵌套类型
当我不添加任何文档时,它起作用了,但是当我添加带有nesed
的任何文档时,它总是返回错误,我该如何解决这个问题?