好吧,对于你们其中一位超级棒的ElasticSearch专家来说,这可能不会太难。我有这个嵌套查询,我想嵌套查询在非嵌套字段(状态)上过滤。我不知道在哪里放置过滤器。我试着把它放在一个查询中(下面),但这并没有给我正确的结果。你能帮我吗?ElasticSearch带过滤器的嵌套查询
{
"aggs": {
"status": {
"terms": {
"field": "status",
"size": 0
}
}
},
"filter": {
"nested": {
"path": "participants",
"filter": {
"bool": {
"must": [
{
"term": {
"user_id": 1
}
},
{
"term": {
"archived": false
}
},
{
"term": {
"has_unread": true
}
}
]
}
}
}
},
"query": {
"filtered": {
"filter": {
"bool": {
"must_not": [
{
"term": {
"status": 8
}
}
]
}
}
}
}
}
谢谢你的回答!我不仅能够使查询正常工作,而且还了解了一些事情。非常感激。 – Cari