本文整理汇总了Java中org.elasticsearch.plugins.ScriptPlugin类的典型用法代码示例。如果您正苦于以下问题:Java ScriptPlugin类的具体用法?Java ScriptPlugin怎么用?Java ScriptPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScriptPlugin类属于org.elasticsearch.plugins包,在下文中一共展示了ScriptPlugin类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createScriptModule
import org.elasticsearch.plugins.ScriptPlugin; //导入依赖的package包/类
ScriptModule createScriptModule(List<ScriptPlugin> scriptPlugins) {
if (scriptPlugins == null || scriptPlugins.isEmpty()) {
return newTestScriptModule();
}
Settings settings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
// no file watching, so we don't need a ResourceWatcherService
.put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING.getKey(), false)
.build();
Environment environment = new Environment(settings);
return ScriptModule.create(settings, environment, null, scriptPlugins);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:AbstractQueryTestCase.java
示例2: create
import org.elasticsearch.plugins.ScriptPlugin; //导入依赖的package包/类
/**
* Build from {@linkplain ScriptPlugin}s. Convenient for normal use but not great for tests. See
* {@link ScriptModule#ScriptModule(Settings, Environment, ResourceWatcherService, List, List)} for easier use in tests.
*/
public static ScriptModule create(Settings settings, Environment environment,
ResourceWatcherService resourceWatcherService, List<ScriptPlugin> scriptPlugins) {
Map<String, NativeScriptFactory> factoryMap = scriptPlugins.stream().flatMap(x -> x.getNativeScripts().stream())
.collect(Collectors.toMap(NativeScriptFactory::getName, Function.identity()));
NativeScriptEngineService nativeScriptEngineService = new NativeScriptEngineService(settings, factoryMap);
List<ScriptEngineService> scriptEngineServices = scriptPlugins.stream().map(x -> x.getScriptEngineService(settings))
.filter(Objects::nonNull).collect(Collectors.toList());
scriptEngineServices.add(nativeScriptEngineService);
List<ScriptContext.Plugin> plugins = scriptPlugins.stream().map(x -> x.getCustomScriptContexts()).filter(Objects::nonNull)
.collect(Collectors.toList());
return new ScriptModule(settings, environment, resourceWatcherService, scriptEngineServices, plugins);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:ScriptModule.java
注:本文中的org.elasticsearch.plugins.ScriptPlugin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论