We have an existing "person" index that has "status" field in it. We have several (around 6) existing queries for retrieving person document with different parameters and logic.
However, we have a new requirement that only "active" status will be retrieved from all queries. Is it possible to apply a "template" and append it to all queries searching on the person index without updating all queries one by one to apply filter for status? This is the query that we need to append for every existing queries we have:
{
"bool": {
"should": [
{
"nested": {
"path": "additionalAttributes",
"query": {
"terms": {
"additionalAttributes.status": [
"active"
]
}
}
}
},
{
"bool": {
"must_not": [
{
"nested": {
"path": "additionalAttributes",
"query": {
"exists": {
"field": "additionalAttributes.status"
}
}
}
}
]
}
}
]
}