Merge branch 'master' into gh-2001
Original commit: elastic/x-pack-elasticsearch@7ebbf816d5
This commit is contained in:
commit
7d0a210813
|
@ -42,7 +42,7 @@ public final class MessyTestUtils {
|
||||||
engineServiceSet.add(groovyScriptEngineService);
|
engineServiceSet.add(groovyScriptEngineService);
|
||||||
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new ScriptEngineRegistry.ScriptEngineRegistration(GroovyScriptEngineService.class, GroovyScriptEngineService.TYPES)
|
new ScriptEngineRegistry.ScriptEngineRegistration(GroovyScriptEngineService.class, GroovyScriptEngineService.NAME)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Arrays.asList(ScriptServiceProxy.INSTANCE));
|
ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Arrays.asList(ScriptServiceProxy.INSTANCE));
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class WatcherTemplateTests extends ESTestCase {
|
||||||
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new ScriptEngineRegistry.ScriptEngineRegistration(MustacheScriptEngineService.class,
|
new ScriptEngineRegistry.ScriptEngineRegistration(MustacheScriptEngineService.class,
|
||||||
MustacheScriptEngineService.TYPES)
|
MustacheScriptEngineService.NAME)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
||||||
|
|
|
@ -38,8 +38,6 @@ public class RestMonitoringBulkAction extends MonitoringRestHandler {
|
||||||
controller.registerHandler(PUT, URI_BASE + "/_bulk", this);
|
controller.registerHandler(PUT, URI_BASE + "/_bulk", this);
|
||||||
controller.registerHandler(POST, URI_BASE + "/{type}/_bulk", this);
|
controller.registerHandler(POST, URI_BASE + "/{type}/_bulk", this);
|
||||||
controller.registerHandler(PUT, URI_BASE + "/{type}/_bulk", this);
|
controller.registerHandler(PUT, URI_BASE + "/{type}/_bulk", this);
|
||||||
controller.registerHandler(POST, URI_BASE + "/{index}/{type}/_bulk", this);
|
|
||||||
controller.registerHandler(PUT, URI_BASE + "/{index}/{type}/_bulk", this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
"xpack.version": "${project.version}"
|
"xpack.version": "${project.version}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"kibana": {
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
"node": {
|
"node": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,8 @@
|
||||||
"methods": ["POST", "PUT"],
|
"methods": ["POST", "PUT"],
|
||||||
"url": {
|
"url": {
|
||||||
"path": "/_x-pack/monitoring/_bulk",
|
"path": "/_x-pack/monitoring/_bulk",
|
||||||
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{index}/_bulk", "/_x-pack/monitoring/{index}/{type}/_bulk"],
|
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{type}/_bulk"],
|
||||||
"parts": {
|
"parts": {
|
||||||
"index": {
|
|
||||||
"type" : "string",
|
|
||||||
"description" : "Default index for items which don't provide one"
|
|
||||||
},
|
|
||||||
"type": {
|
"type": {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "Default document type for items which don't provide one"
|
"description" : "Default document type for items which don't provide one"
|
||||||
|
|
|
@ -107,11 +107,11 @@ public class ShieldServerTransportService extends TransportService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <Request extends TransportRequest> void registerRequestHandler(String action, Supplier<Request> request, String executor,
|
public <Request extends TransportRequest> void registerRequestHandler(String action, Supplier<Request> request, String executor,
|
||||||
boolean forceExecution,
|
boolean forceExecution, boolean canTripCircuitBreaker,
|
||||||
TransportRequestHandler<Request> handler) {
|
TransportRequestHandler<Request> handler) {
|
||||||
TransportRequestHandler<Request> wrappedHandler = new ProfileSecuredRequestHandler<>(action, handler, profileFilters,
|
TransportRequestHandler<Request> wrappedHandler = new ProfileSecuredRequestHandler<>(action, handler, profileFilters,
|
||||||
licenseState, threadPool.getThreadContext());
|
licenseState, threadPool.getThreadContext());
|
||||||
super.registerRequestHandler(action, request, executor, forceExecution, wrappedHandler);
|
super.registerRequestHandler(action, request, executor, forceExecution, canTripCircuitBreaker, wrappedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, ServerTransportFilter> initializeProfileFilters() {
|
protected Map<String, ServerTransportFilter> initializeProfileFilters() {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.script;
|
package org.elasticsearch.script;
|
||||||
|
|
||||||
|
import org.elasticsearch.script.ScriptMode;
|
||||||
import org.elasticsearch.xpack.common.text.DefaultTextTemplateEngine;
|
import org.elasticsearch.xpack.common.text.DefaultTextTemplateEngine;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -29,28 +30,27 @@ public class MockMustacheScriptEngine extends MockScriptEngine {
|
||||||
|
|
||||||
public void onModule(ScriptModule module) {
|
public void onModule(ScriptModule module) {
|
||||||
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(MockMustacheScriptEngine.class,
|
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(MockMustacheScriptEngine.class,
|
||||||
Collections.singletonList(NAME)));
|
NAME, ScriptMode.ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTypes() {
|
public String getType() {
|
||||||
return Collections.singletonList(NAME);
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getExtensions() {
|
public String getExtension() {
|
||||||
return getTypes();
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object compile(String script, Map<String, String> params) {
|
public Object compile(String name, String script, Map<String, String> params) {
|
||||||
if (script.contains("{{") && script.contains("}}")) {
|
if (script.contains("{{") && script.contains("}}")) {
|
||||||
throw new IllegalArgumentException("Fix your test to not rely on mustache");
|
throw new IllegalArgumentException("Fix your test to not rely on mustache");
|
||||||
}
|
}
|
||||||
|
|
||||||
return script;
|
return super.compile(name, script, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.elasticsearch.script;
|
||||||
|
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
import org.elasticsearch.script.ScriptMode;
|
||||||
import org.elasticsearch.search.lookup.SearchLookup;
|
import org.elasticsearch.search.lookup.SearchLookup;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -21,8 +22,6 @@ public class SleepScriptEngine implements ScriptEngineService {
|
||||||
|
|
||||||
public static final String NAME = "sleep";
|
public static final String NAME = "sleep";
|
||||||
|
|
||||||
public static final List<String> TYPES = Collections.singletonList(NAME);
|
|
||||||
|
|
||||||
public static class TestPlugin extends Plugin {
|
public static class TestPlugin extends Plugin {
|
||||||
|
|
||||||
public TestPlugin() {
|
public TestPlugin() {
|
||||||
|
@ -39,29 +38,25 @@ public class SleepScriptEngine implements ScriptEngineService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(ScriptModule module) {
|
public void onModule(ScriptModule module) {
|
||||||
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(SleepScriptEngine.class, SleepScriptEngine.TYPES));
|
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(SleepScriptEngine.class,
|
||||||
|
SleepScriptEngine.NAME, ScriptMode.ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTypes() {
|
public String getType() {
|
||||||
return TYPES;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getExtensions() {
|
public String getExtension() {
|
||||||
return TYPES;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSandboxed() {
|
public Object compile(String scriptName, String scriptSource, Map<String, String> params) {
|
||||||
return true;
|
return scriptSource;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object compile(String script, Map<String, String> params) {
|
|
||||||
return script;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -136,6 +136,7 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
|
||||||
.put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100))
|
.put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100))
|
||||||
.put(ShieldSettings.settings(shieldEnabled))
|
.put(ShieldSettings.settings(shieldEnabled))
|
||||||
.put("xpack.watcher.trigger.schedule.engine", scheduleImplName)
|
.put("xpack.watcher.trigger.schedule.engine", scheduleImplName)
|
||||||
|
.put("script.inline", "true")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue