How to execute Must and Should query that matches an individual Nested field?

This is an old slide but might help paint the picture.

A single JSON document has nested elements unpacked into adjacent Lucene documents.
The "nested" query essentially acts as a translation point. Whatever criteria you put underneath (including bool queries) matches an inner Lucene document but the nested clause translates any reported matches as a hit on the Lucene document that contains it. The "nested" clause simply establishes a new context for the criteria it contains.

1 Like