use of org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest in project elasticsearch by elastic.
the class RestPutStoredScriptAction 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;
}
BytesReference content = request.content();
if (lang != null) {
deprecationLogger.deprecated("specifying lang [" + lang + "] as part of the url path is deprecated, use request content instead");
}
PutStoredScriptRequest putRequest = new PutStoredScriptRequest(id, lang, content, request.getXContentType());
return channel -> client.admin().cluster().putStoredScript(putRequest, new AcknowledgedRestListener<>(channel));
}
use of org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest in project elasticsearch by elastic.
the class RestPutSearchTemplateAction method prepareRequest.
@Override
public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
String id = request.param("id");
BytesReference content = request.content();
PutStoredScriptRequest put = new PutStoredScriptRequest(id, Script.DEFAULT_TEMPLATE_LANG, content, request.getXContentType());
return channel -> client.admin().cluster().putStoredScript(put, new AcknowledgedRestListener<>(channel));
}
Aggregations