当前位置: 首页>>代码示例>>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;未经允许,请勿转载。