use of org.opensearch.script.ScriptEngine in project OpenSearch by opensearch-project.
the class ScriptedMetricAggregatorTests method getMockScriptService.
@Override
protected ScriptService getMockScriptService() {
MockScriptEngine scriptEngine = new MockScriptEngine(MockScriptEngine.NAME, SCRIPTS, Collections.emptyMap());
Map<String, ScriptEngine> engines = Collections.singletonMap(scriptEngine.getType(), scriptEngine);
return new ScriptService(Settings.EMPTY, engines, ScriptModule.CORE_CONTEXTS);
}
use of org.opensearch.script.ScriptEngine in project OpenSearch by opensearch-project.
the class NestedAggregatorTests method getMockScriptService.
@Override
protected ScriptService getMockScriptService() {
Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
scripts.put(INVERSE_SCRIPT, vars -> -((Number) vars.get("_value")).doubleValue());
MockScriptEngine scriptEngine = new MockScriptEngine(MockScriptEngine.NAME, scripts, Collections.emptyMap());
Map<String, ScriptEngine> engines = Collections.singletonMap(scriptEngine.getType(), scriptEngine);
return new ScriptService(Settings.EMPTY, engines, ScriptModule.CORE_CONTEXTS);
}
Aggregations