Search in sources :

Example 1 with DeleteStoredScriptRequest

use of org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest in project elasticsearch by elastic.

the class RestDeleteSearchTemplateAction method prepareRequest.

@Override
public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    String id = request.param("id");
    DeleteStoredScriptRequest deleteStoredScriptRequest = new DeleteStoredScriptRequest(id, Script.DEFAULT_TEMPLATE_LANG);
    return channel -> client.admin().cluster().deleteStoredScript(deleteStoredScriptRequest, new AcknowledgedRestListener<>(channel));
}
Also used : BaseRestHandler(org.elasticsearch.rest.BaseRestHandler) Script(org.elasticsearch.script.Script) Settings(org.elasticsearch.common.settings.Settings) DELETE(org.elasticsearch.rest.RestRequest.Method.DELETE) RestRequest(org.elasticsearch.rest.RestRequest) DeleteStoredScriptRequest(org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest) NodeClient(org.elasticsearch.client.node.NodeClient) IOException(java.io.IOException) RestController(org.elasticsearch.rest.RestController) AcknowledgedRestListener(org.elasticsearch.rest.action.AcknowledgedRestListener) DeleteStoredScriptRequest(org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest)

Example 2 with DeleteStoredScriptRequest

use of org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest in project elasticsearch by elastic.

the class RestDeleteStoredScriptAction method prepareRequest.

@Override
public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    String id = request.param("id");
    String lang = request.param("lang");
    // name ordering issues in the handlers' paths.
    if (id == null) {
        id = lang;
        lang = null;
    }
    if (lang != null) {
        deprecationLogger.deprecated("specifying lang [" + lang + "] as part of the url path is deprecated");
    }
    DeleteStoredScriptRequest deleteStoredScriptRequest = new DeleteStoredScriptRequest(id, lang);
    return channel -> client.admin().cluster().deleteStoredScript(deleteStoredScriptRequest, new AcknowledgedRestListener<>(channel));
}
Also used : BaseRestHandler(org.elasticsearch.rest.BaseRestHandler) Settings(org.elasticsearch.common.settings.Settings) DELETE(org.elasticsearch.rest.RestRequest.Method.DELETE) RestRequest(org.elasticsearch.rest.RestRequest) DeleteStoredScriptRequest(org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest) NodeClient(org.elasticsearch.client.node.NodeClient) IOException(java.io.IOException) RestController(org.elasticsearch.rest.RestController) AcknowledgedRestListener(org.elasticsearch.rest.action.AcknowledgedRestListener) DeleteStoredScriptRequest(org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest)

Aggregations

IOException (java.io.IOException)2 DeleteStoredScriptRequest (org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest)2 NodeClient (org.elasticsearch.client.node.NodeClient)2 Settings (org.elasticsearch.common.settings.Settings)2 BaseRestHandler (org.elasticsearch.rest.BaseRestHandler)2 RestController (org.elasticsearch.rest.RestController)2 RestRequest (org.elasticsearch.rest.RestRequest)2 DELETE (org.elasticsearch.rest.RestRequest.Method.DELETE)2 AcknowledgedRestListener (org.elasticsearch.rest.action.AcknowledgedRestListener)2 Script (org.elasticsearch.script.Script)1