本文整理汇总了Java中org.elasticsearch.search.internal.SearchContext.getObjectMapper方法的典型用法代码示例。如果您正苦于以下问题:Java SearchContext.getObjectMapper方法的具体用法?Java SearchContext.getObjectMapper怎么用?Java SearchContext.getObjectMapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.search.internal.SearchContext
的用法示例。
在下文中一共展示了SearchContext.getObjectMapper方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doBuild
import org.elasticsearch.search.internal.SearchContext; //导入方法依赖的package包/类
@Override
protected AggregatorFactory<?> doBuild(SearchContext context, AggregatorFactory<?> parent, Builder subFactoriesBuilder)
throws IOException {
ObjectMapper childObjectMapper = context.getObjectMapper(path);
if (childObjectMapper == null) {
// in case the path has been unmapped:
return new NestedAggregatorFactory(name, null, null, context, parent, subFactoriesBuilder, metaData);
}
if (childObjectMapper.nested().isNested() == false) {
throw new AggregationExecutionException("[nested] nested path [" + path + "] is not nested");
}
try {
ObjectMapper parentObjectMapper = context.getQueryShardContext().nestedScope().nextLevel(childObjectMapper);
return new NestedAggregatorFactory(name, parentObjectMapper, childObjectMapper, context, parent, subFactoriesBuilder,
metaData);
} finally {
context.getQueryShardContext().nestedScope().previousLevel();
}
}
示例2: parseNested
import org.elasticsearch.search.internal.SearchContext; //导入方法依赖的package包/类
private InnerHitsContext.NestedInnerHits parseNested(XContentParser parser, QueryParseContext parseContext, SearchContext searchContext, String nestedPath) throws Exception {
ObjectMapper objectMapper = searchContext.getObjectMapper(nestedPath);
if (objectMapper == null) {
throw new IllegalArgumentException("path [" + nestedPath +"] doesn't exist");
}
if (objectMapper.nested().isNested() == false) {
throw new IllegalArgumentException("path [" + nestedPath +"] isn't nested");
}
ObjectMapper parentObjectMapper = parseContext.nestedScope().nextLevel(objectMapper);
ParseResult parseResult = parseSubSearchContext(searchContext, parseContext, parser);
parseContext.nestedScope().previousLevel();
return new InnerHitsContext.NestedInnerHits(parseResult.context(), parseResult.query(), parseResult.childInnerHits(), parentObjectMapper, objectMapper);
}
示例3: doBuild
import org.elasticsearch.search.internal.SearchContext; //导入方法依赖的package包/类
@Override
protected AggregatorFactory<?> doBuild(SearchContext context, AggregatorFactory<?> parent, Builder subFactoriesBuilder)
throws IOException {
if (findNestedAggregatorFactory(parent) == null) {
throw new SearchParseException(context,
"Reverse nested aggregation [" + name + "] can only be used inside a [nested] aggregation", null);
}
ObjectMapper parentObjectMapper = null;
if (path != null) {
parentObjectMapper = context.getObjectMapper(path);
if (parentObjectMapper == null) {
return new ReverseNestedAggregatorFactory(name, true, null, context, parent, subFactoriesBuilder, metaData);
}
if (parentObjectMapper.nested().isNested() == false) {
throw new AggregationExecutionException("[reverse_nested] nested path [" + path + "] is not nested");
}
}
NestedScope nestedScope = context.getQueryShardContext().nestedScope();
try {
nestedScope.nextLevel(parentObjectMapper);
return new ReverseNestedAggregatorFactory(name, false, parentObjectMapper, context, parent, subFactoriesBuilder,
metaData);
} finally {
nestedScope.previousLevel();
}
}