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