当前位置: 首页>>代码示例>>Java>>正文


Java SearchContext.getObjectMapper方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:NestedAggregationBuilder.java

示例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);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:InnerHitsParseElement.java

示例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();
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:ReverseNestedAggregationBuilder.java


注:本文中的org.elasticsearch.search.internal.SearchContext.getObjectMapper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。