本文整理汇总了Java中org.elasticsearch.index.query.QueryParseContext.reset方法的典型用法代码示例。如果您正苦于以下问题:Java QueryParseContext.reset方法的具体用法?Java QueryParseContext.reset怎么用?Java QueryParseContext.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.index.query.QueryParseContext
的用法示例。
在下文中一共展示了QueryParseContext.reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.elasticsearch.index.query.QueryParseContext; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext searchContext) throws Exception {
QueryParseContext context = searchContext.queryParserService().getParseContext();
context.reset(parser);
Map<String, InnerHitsContext.BaseInnerHits> topLevelInnerHits = parseInnerHits(parser, context, searchContext);
if (topLevelInnerHits != null) {
InnerHitsContext innerHitsContext = searchContext.innerHits();
innerHitsContext.addInnerHitDefinitions(topLevelInnerHits);
}
}
示例2: parseQuery
import org.elasticsearch.index.query.QueryParseContext; //导入方法依赖的package包/类
private Query parseQuery(String type, XContentParser parser) {
String[] previousTypes = null;
if (type != null) {
QueryParseContext.setTypesWithPrevious(new String[]{type});
}
QueryParseContext context = queryParserService.getParseContext();
try {
context.reset(parser);
// This means that fields in the query need to exist in the mapping prior to registering this query
// The reason that this is required, is that if a field doesn't exist then the query assumes defaults, which may be undesired.
//
// Even worse when fields mentioned in percolator queries do go added to map after the queries have been registered
// then the percolator queries don't work as expected any more.
//
// Query parsing can't introduce new fields in mappings (which happens when registering a percolator query),
// because field type can't be inferred from queries (like document do) so the best option here is to disallow
// the usage of unmapped fields in percolator queries to avoid unexpected behaviour
//
// if index.percolator.map_unmapped_fields_as_string is set to true, query can contain unmapped fields which will be mapped
// as an analyzed string.
context.setAllowUnmappedFields(false);
context.setMapUnmappedFieldAsString(mapUnmappedFieldsAsString ? true : false);
return queryParserService.parseInnerQuery(context);
} catch (IOException e) {
throw new QueryParsingException(context, "Failed to parse", e);
} finally {
if (type != null) {
QueryParseContext.setTypes(previousTypes);
}
context.reset(null);
}
}
示例3: validateAliasFilter
import org.elasticsearch.index.query.QueryParseContext; //导入方法依赖的package包/类
private void validateAliasFilter(XContentParser parser, IndexQueryParserService indexQueryParserService) throws IOException {
QueryParseContext context = indexQueryParserService.getParseContext();
try {
context.reset(parser);
context.parseInnerFilter();
} finally {
context.reset(null);
parser.close();
}
}