當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。