if (type != null) {
QueryParseContext.setTypesWithPrevious(new String[]{type});
}
QueryParseContext context = cache.get();
try {
context.reset(parser);
context.setAllowUnmappedFields(allowUnmappedFields);
return queryParserService.parseInnerQuery(context);
} catch (IOException e) {
throw new QueryParsingException(queryParserService.index(), "Failed to parse", e);
} finally {