Elasticsearch wraps the query thus detected in the ESToParentBlockJoinQuery object. A nested query is not always recommended. Because for sorting and agrgregation you need to recover the original form of the query.