有嵌套查询术语过滤器https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html和布尔术语过滤器https://www.elastic 的文档。 co/guide/en/elasticsearch/reference/5.5/query-dsl-bool-query.html
嵌套是对象数组。不仅仅是对象。这就是我不能使用简单的布尔术语过滤器。
我的查询如下所示:
{
"query": {
"bool": {
"filter": [
{
"term": {
"access_account.nid": 17,
"destroyed_at": null
}
}
],
"must": {
"match_all": {}
}
},
"nested": {
"path": "categories",
"query": {
"bool": {
"filter": [
{
"terms": {
"categories.id": [
15, 17
]
}
}
]
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
过滤器是数组,因为我实际上有更多的过滤器。
我收到这个回复
reason": "[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]"
有没有解决方案如何组合父/嵌套术语过滤器?官方文档没有帮助。
我的Elastic版本是5.4
谢谢。