Because nested objects
are indexed as separate hidden documents, we can’t
query them directly.
Instead, we have to use the
nested query to access them:
nested field can contain other
nested fields. Similarly, a
query can contain other
nested queries. The nesting hierarchy is applied
as you would expect.
Of course, a
nested query could match several nested documents.
Each matching nested document would have its own relevance score, but these
multiple scores need to be reduced to a single score that can be applied to
the root document.
By default, it averages the scores of the matching nested documents. This can
be controlled by setting the
score_mode parameter to
none (in which case the root document gets a constant score of
nested filter behaves much like a
nested query, except that it doesn’t
score_mode parameter. It can be used only in filter context—such as inside a
filtered query—and it behaves like any other filter:
it includes or excludes, but it doesn’t score.
While the results of the
nested filter itself are not cached, the usual
caching rules apply to the filter inside the