本文整理匯總了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}"));
}
示例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();
}
示例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();
}
示例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;
}
}
示例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;
}
}