In an Elasticsearch query, does it matter where we place the filter?
The examples I come across put filter after the query. Like the following:
GET _search
{
"query": {
"bool": {
"must": {
"match": {
"text": "quick brown fox"
}
},
"filter": {
"term": {
"status": "published"
}
}
}
}
}
If the filter is put first above the "must match" sub body, does this affect how Elasticsearch executes the query i.e. Does it run the filter first then run the query on the subset of documents?
Or is there no difference at all?