query.setBoost(boost);
// wrap the query with type query
query = new FilteredQuery(query, parseContext.cacheFilter(childDocMapper.typeFilter(), null));
SearchContext searchContext = SearchContext.current();
HasChildFilter childFilter = new HasChildFilter(query, scope, childType, parentType, searchContext);
// we don't need DeletionAwareConstantScore, since we filter deleted parent docs in the filter
ConstantScoreQuery childQuery = new ConstantScoreQuery(childFilter);
childQuery.setBoost(boost);
searchContext.addScopePhase(childFilter);
return childQuery;