Sequence of clauses for performance


I was curious to know whether the sequence of the clauses matter when we query elasticsearch.

If clause A matches 5k docs and clause B matches 2k docs. Which clause should be placed before the other one ? Or the sequence does not matter ?

Same question for clause sequence in filters too ?