About covered query

To fullfil the cretereas of a covered query, is the projection step to have the same fields exactly like in the indexe mandatory? or it also works when the projection step is absent?

Hey @Ruiting_57193

A covered query is a query that can be satisfied entirely using an index and does not have to examine any documents. An index covers a query when both of the following apply:

  • all the fields in the query are part of an index, and
  • all the fields returned in the results are in the same index.

So almost all of the time yes the project stage is needed to trim down the document to only return the fields covered by the index.

However if you have a situation where your document is very small, say one or two fields only, and the index you built includes all fields then the project step is not needed; but i do not think this will likely happen very much.

1 Like