當前位置: 首頁>>代碼示例>>Java>>正文


Java Script.getParams方法代碼示例

本文整理匯總了Java中org.elasticsearch.script.Script.getParams方法的典型用法代碼示例。如果您正苦於以下問題:Java Script.getParams方法的具體用法?Java Script.getParams怎麽用?Java Script.getParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.script.Script的用法示例。


在下文中一共展示了Script.getParams方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSimpleBulk4

import org.elasticsearch.script.Script; //導入方法依賴的package包/類
public void testSimpleBulk4() throws Exception {
    String bulkAction = copyToStringFromClasspath("/org/elasticsearch/action/bulk/simple-bulk4.json");
    BulkRequest bulkRequest = new BulkRequest();
    bulkRequest.add(bulkAction.getBytes(StandardCharsets.UTF_8), 0, bulkAction.length(), null, null, XContentType.JSON);
    assertThat(bulkRequest.numberOfActions(), equalTo(4));
    assertThat(((UpdateRequest) bulkRequest.requests().get(0)).id(), equalTo("1"));
    assertThat(((UpdateRequest) bulkRequest.requests().get(0)).retryOnConflict(), equalTo(2));
    assertThat(((UpdateRequest) bulkRequest.requests().get(0)).doc().source().utf8ToString(), equalTo("{\"field\":\"value\"}"));
    assertThat(((UpdateRequest) bulkRequest.requests().get(1)).id(), equalTo("0"));
    assertThat(((UpdateRequest) bulkRequest.requests().get(1)).type(), equalTo("type1"));
    assertThat(((UpdateRequest) bulkRequest.requests().get(1)).index(), equalTo("index1"));
    Script script = ((UpdateRequest) bulkRequest.requests().get(1)).script();
    assertThat(script, notNullValue());
    assertThat(script.getIdOrCode(), equalTo("counter += param1"));
    assertThat(script.getLang(), equalTo("javascript"));
    Map<String, Object> scriptParams = script.getParams();
    assertThat(scriptParams, notNullValue());
    assertThat(scriptParams.size(), equalTo(1));
    assertThat(((Integer) scriptParams.get("param1")), equalTo(1));
    assertThat(((UpdateRequest) bulkRequest.requests().get(1)).upsertRequest().source().utf8ToString(), equalTo("{\"counter\":1}"));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:22,代碼來源:BulkRequestTests.java

示例2: buildScriptApplier

import org.elasticsearch.script.Script; //導入方法依賴的package包/類
@Override
public BiFunction<RequestWrapper<?>, ScrollableHitSource.Hit, RequestWrapper<?>> buildScriptApplier() {
    Script script = mainRequest.getScript();
    if (script != null) {
        return new UpdateByQueryScriptApplier(task, scriptService, script, script.getParams());
    }
    return super.buildScriptApplier();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:TransportUpdateByQueryAction.java

示例3: buildScriptApplier

import org.elasticsearch.script.Script; //導入方法依賴的package包/類
@Override
public BiFunction<RequestWrapper<?>, ScrollableHitSource.Hit, RequestWrapper<?>> buildScriptApplier() {
    Script script = mainRequest.getScript();
    if (script != null) {
        return new ReindexScriptApplier(task, scriptService, script, script.getParams());
    }
    return super.buildScriptApplier();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:9,代碼來源:TransportReindexAction.java

示例4: deepCopyScript

import org.elasticsearch.script.Script; //導入方法依賴的package包/類
private static Script deepCopyScript(Script script, SearchContext context) {
    if (script != null) {
        Map<String, Object> params = script.getParams();
        if (params != null) {
            params = deepCopyParams(params, context);
        }
        return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
    } else {
        return null;
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:12,代碼來源:ScriptedMetricAggregatorFactory.java

示例5: deepCopyScript

import org.elasticsearch.script.Script; //導入方法依賴的package包/類
private static Script deepCopyScript(Script script, SearchContext context) {
    if (script != null) {
        Map<String, Object> params = script.getParams();
        if (params != null) {
            params = deepCopyParams(params, context);
        }
        return new Script(script.getScript(), script.getType(), script.getLang(), params);
    } else {
        return null;
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:12,代碼來源:ScriptedMetricAggregator.java


注:本文中的org.elasticsearch.script.Script.getParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。