In ElasticSearch, what's the rough implementation for an AND-style boolean query where the fields are term types? Does ElasticSearch run filter queries separately on each of the field, and then find their intersections?
For example, if I have something like
{
"query": {
"bool" : {
"must" : {
"term" : { "first_name": "John" },
"term" : { "dob": "01-01-1990"}
}
}
}
does it first get all documents with "first_name": John", all documents with "dob": "01-01-1990", and then find the intersecting documents from each of the results? If that's the case does it imply that these kinds of queries can potentially be extremely slow, since the matching results for each terms individually can be extremely large and thus finding the intersection would be slow?