OK, this this one will probably not be too hard for one of you super awesome ElasticSearch experts out there. I've got this nested query, and I want the nested query to be filtered on a non-nested field (status). I don't know where to put the filter. I tried putting it in a query (below) but that's not giving me the right results. Can you help me out?
{
"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
}
}
]
}
}
}
}
}