How filters mechanism works


i was wondering how elasticsearch implements the filtering process.
For example if do a text-search for the word "like" and then i add a filter "type:tweet", how this operation will be executed?
I imagine that elastiseach first searchs in inverted index for the word "like", finds the docs, and then filters them returning the final bucket.
Is that right, or i'm mising sth?

From the documentation:

Internal Filter Operation

Internally, Elasticsearch is performing several operations when executing a filter:

Find matching docs.

The term filter looks up the term XHDK-A-1293-#fJ3 in the inverted index and retrieves the list of documents that contain that term. In this case, only document 1 has the term we are looking for.

Build a bitset.

The filter then builds a bitset--an array of 1s and 0s—that describes which documents contain the term. Matching documents receive a 1 bit. In our example, the bitset would be [1,0,0,0].

Cache the bitset.

Last, the bitset is stored in memory, since we can use this in the future and skip steps 1 and 2. This adds a lot of performance and makes filters very fast.

When executing a filtered query, the filter is executed before the query. The resulting bitset is given to the query, which uses it to simply skip over any documents that have already been excluded by the filter. This is one of the ways that filters can improve performance. Fewer documents evaluated by the query means faster response times.