我正在尝试使用嵌套类别创建子/父映射,但是smohow结果令人困惑
首先我创建了一个索引
PUT /categories/ {}
然后映射
/categories/category/_mappings
{
"_parent": {"type": "category"}
}
索引
PUT /categories/category/1?parent=0
{
"name": "Grandparent"
},
PUT /categories/category/2?parent=0
{
"name": "Grandmother"
}
PUT /categories/category/3?parent=1
{
"name": "father"
},
PUT /categories/category/4?parent=1
{
"name": "mother"
}
我希望流畅的搜索会让我回归“祖父母”类别,但它会让我回归零点
GET /categories/category/_search
{
"query": {
"has_child": {
"type": "category",
"query" : {
"filtered": {
"query": { "match_all": {}}
}
}
}
}
}