本文整理汇总了Java中org.elasticsearch.script.ScriptEngineService类的典型用法代码示例。如果您正苦于以下问题:Java ScriptEngineService类的具体用法?Java ScriptEngineService怎么用?Java ScriptEngineService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScriptEngineService类属于org.elasticsearch.script包,在下文中一共展示了ScriptEngineService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testJsonEscapeEncoder
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
public void testJsonEscapeEncoder() {
final ScriptEngineService engine = new MustacheScriptEngineService();
final Map<String, String> params = randomBoolean() ? singletonMap(Script.CONTENT_TYPE_OPTION, JSON_MIME_TYPE) : emptyMap();
Mustache script = (Mustache) engine.compile(null, "{\"field\": \"{{value}}\"}", params);
CompiledScript compiled = new CompiledScript(INLINE, null, MustacheScriptEngineService.NAME, script);
ExecutableScript executable = engine.executable(compiled, singletonMap("value", "a \"value\""));
BytesReference result = (BytesReference) executable.run();
assertThat(result.utf8ToString(), equalTo("{\"field\": \"a \\\"value\\\"\"}"));
}
示例2: testDefaultEncoder
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
public void testDefaultEncoder() {
final ScriptEngineService engine = new MustacheScriptEngineService();
final Map<String, String> params = singletonMap(Script.CONTENT_TYPE_OPTION, PLAIN_TEXT_MIME_TYPE);
Mustache script = (Mustache) engine.compile(null, "{\"field\": \"{{value}}\"}", params);
CompiledScript compiled = new CompiledScript(INLINE, null, MustacheScriptEngineService.NAME, script);
ExecutableScript executable = engine.executable(compiled, singletonMap("value", "a \"value\""));
BytesReference result = (BytesReference) executable.run();
assertThat(result.utf8ToString(), equalTo("{\"field\": \"a \"value\"\"}"));
}
示例3: testUrlEncoder
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
public void testUrlEncoder() {
final ScriptEngineService engine = new MustacheScriptEngineService();
final Map<String, String> params = singletonMap(Script.CONTENT_TYPE_OPTION, X_WWW_FORM_URLENCODED_MIME_TYPE);
Mustache script = (Mustache) engine.compile(null, "{\"field\": \"{{value}}\"}", params);
CompiledScript compiled = new CompiledScript(INLINE, null, MustacheScriptEngineService.NAME, script);
ExecutableScript executable = engine.executable(compiled, singletonMap("value", "tilde~ AND date:[2016 FROM*]"));
BytesReference result = (BytesReference) executable.run();
assertThat(result.utf8ToString(), equalTo("{\"field\": \"tilde%7E+AND+date%3A%5B2016+FROM*%5D\"}"));
}
示例4: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new ExpressionScriptEngineService(settings);
}
示例5: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new MustacheScriptEngineService();
}
示例6: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new PainlessScriptEngineService(settings);
}
示例7: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
/**
* Returns a {@link ScriptEngineService} instance or <code>null</code> if this plugin doesn't add a new script engine
*/
default ScriptEngineService getScriptEngineService(Settings settings) {
return null;
}
示例8: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new PutFieldValuesScriptEngine();
}
示例9: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new ExtractFieldScriptEngine();
}
示例10: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new FieldValueScriptEngine();
}
示例11: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new DummyTemplateScriptEngine();
}
示例12: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
public final ScriptEngineService getScriptEngineService(Settings settings) {
return new VectorScoringScriptEngineService(settings);
}
示例13: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
// you can add a new script engine, or you can use settings to get defined values
// String redisHost = settings.get("redis.host", "127.0.0.1");
return null;
}
示例14: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new RankLibScriptEngine(settings, parserFactory);
}
示例15: getScriptEngineService
import org.elasticsearch.script.ScriptEngineService; //导入依赖的package包/类
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new PMMLModelScriptEngineService(settings);
}