Alias with query clause

You're almost there, you just need to use the filter keyword instead of query

PUT /sports/_alias/baseball
{ 
  "filter": {                <--- change this
    "bool": { 
      "must": [
        { "match": { "content": "baseball" }}  
      ],
      "filter": [ 
        { "term":  { "processed": "true" }}
      ]
    }
  }
}

However, since this is really a filter (i.e. there is no scoring involved, the goal is just to tell if a document should come up in the alias or not), you can move the match from the must to the filter section, like this:

PUT /sports/_alias/baseball
{ 
  "filter": {                <--- change this
    "bool": { 
      "filter": [ 
        { "match": { "content": "baseball" }},            <--- and this
        { "term":  { "processed": "true" }}
      ]
    }
  }
}
1 Like