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


Java SearchRequest.extraSource方法代码示例

本文整理汇总了Java中org.elasticsearch.action.search.SearchRequest.extraSource方法的典型用法代码示例。如果您正苦于以下问题:Java SearchRequest.extraSource方法的具体用法?Java SearchRequest.extraSource怎么用?Java SearchRequest.extraSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.action.search.SearchRequest的用法示例。


在下文中一共展示了SearchRequest.extraSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toSearchRequest

import org.elasticsearch.action.search.SearchRequest; //导入方法依赖的package包/类
public SearchRequest toSearchRequest() {
    SearchRequest searchRequest = new SearchRequest(indices());
    searchRequest.indicesOptions(indicesOptions());
    searchRequest.types(types());
    searchRequest.routing(routing());
    searchRequest.preference(preference());
    searchRequest.source(source());
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
    searchSourceBuilder.size(0);
    if (minScore() != DEFAULT_MIN_SCORE) {
        searchSourceBuilder.minScore(minScore());
    }
    if (terminateAfter() != DEFAULT_TERMINATE_AFTER) {
        searchSourceBuilder.terminateAfter(terminateAfter());
    }
    searchRequest.extraSource(searchSourceBuilder);
    return searchRequest;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:CountRequest.java

示例2: ShardSearchLocalRequest

import org.elasticsearch.action.search.SearchRequest; //导入方法依赖的package包/类
ShardSearchLocalRequest(SearchRequest searchRequest, ShardRouting shardRouting, int numberOfShards,
                        String[] filteringAliases, long nowInMillis) {
    this(shardRouting.shardId(), numberOfShards, searchRequest.searchType(),
            searchRequest.source(), searchRequest.types(), searchRequest.requestCache());
    this.extraSource = searchRequest.extraSource();
    this.templateSource = searchRequest.templateSource();
    this.template = searchRequest.template();
    this.scroll = searchRequest.scroll();
    this.filteringAliases = filteringAliases;
    this.nowInMillis = nowInMillis;
    copyContextAndHeadersFrom(searchRequest);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:ShardSearchLocalRequest.java

示例3: generateLocalSearchRequest

import org.elasticsearch.action.search.SearchRequest; //导入方法依赖的package包/类
private static SearchRequest generateLocalSearchRequest(String source, String indexName, String type) {
    LocalRestRequest localRestRequest = new LocalRestRequest("/_search", Method.POST);
    localRestRequest.setContent(source, null);
    SearchRequest searchRequest = new SearchRequest();
    searchRequest.indices(Strings.splitStringByCommaToArray(indexName));
    // get the content, and put it in the body
    // add content/source as template if template flag is set
    searchRequest.source(localRestRequest.content());
    searchRequest.searchType(SearchType.QUERY_AND_FETCH);
    searchRequest.extraSource(RestSearchAction.parseSearchSource(localRestRequest));
    searchRequest.types(Strings.splitStringByCommaToArray(type));
    searchRequest.putHeader("search_source", "reindex");
    return searchRequest;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:IndexShard.java

示例4: parseSearchRequest

import org.elasticsearch.action.search.SearchRequest; //导入方法依赖的package包/类
public static void parseSearchRequest(SearchRequest searchRequest, RestRequest request, ParseFieldMatcher parseFieldMatcher,
        BytesReference bodyContent) {
    searchRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));
    // get the content, and put it in the body
    // add content/source as template if template flag is set
    boolean isTemplateRequest = request.path().endsWith("/template");
    if (bodyContent == null) {
        if (RestActions.hasBodyContent(request)) {
            bodyContent = RestActions.getRestContent(request);
        }
    }
    if (bodyContent != null) {
        if (isTemplateRequest) {
            searchRequest.templateSource(bodyContent);
        } else {
            searchRequest.source(bodyContent);
        }
    }

    // do not allow 'query_and_fetch' or 'dfs_query_and_fetch' search types
    // from the REST layer. these modes are an internal optimization and should
    // not be specified explicitly by the user.
    String searchType = request.param("search_type");
    if (SearchType.fromString(searchType, parseFieldMatcher).equals(SearchType.QUERY_AND_FETCH) ||
            SearchType.fromString(searchType, parseFieldMatcher).equals(SearchType.DFS_QUERY_AND_FETCH)) {
        throw new IllegalArgumentException("Unsupported search type [" + searchType + "]");
    } else {
        searchRequest.searchType(searchType);
    }

    searchRequest.extraSource(parseSearchSource(request));
    searchRequest.requestCache(request.paramAsBoolean("request_cache", null));

    String scroll = request.param("scroll");
    if (scroll != null) {
        searchRequest.scroll(new Scroll(parseTimeValue(scroll, null, "scroll")));
    }

    searchRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
    searchRequest.routing(request.param("routing"));
    searchRequest.preference(request.param("preference"));
    searchRequest.indicesOptions(IndicesOptions.fromRequest(request, searchRequest.indicesOptions()));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:44,代码来源:RestSearchAction.java


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