本文整理匯總了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();
}
}