本文整理汇总了Java中org.elasticsearch.script.Script.DEFAULT_TEMPLATE_LANG属性的典型用法代码示例。如果您正苦于以下问题:Java Script.DEFAULT_TEMPLATE_LANG属性的具体用法?Java Script.DEFAULT_TEMPLATE_LANG怎么用?Java Script.DEFAULT_TEMPLATE_LANG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.elasticsearch.script.Script
的用法示例。
在下文中一共展示了Script.DEFAULT_TEMPLATE_LANG属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
示例2: 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));
}
示例3: prepareRequest
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, NodeClient client) throws IOException {
String id = request.param("id");
GetStoredScriptRequest getRequest = new GetStoredScriptRequest(id, Script.DEFAULT_TEMPLATE_LANG);
return channel -> client.admin().cluster().getStoredScript(getRequest, new RestBuilderListener<GetStoredScriptResponse>(channel) {
@Override
public RestResponse buildResponse(GetStoredScriptResponse response, XContentBuilder builder) throws Exception {
builder.startObject();
builder.field(_ID_PARSE_FIELD.getPreferredName(), id);
builder.field(StoredScriptSource.LANG_PARSE_FIELD.getPreferredName(), Script.DEFAULT_TEMPLATE_LANG);
StoredScriptSource source = response.getSource();
boolean found = source != null;
builder.field(FOUND_PARSE_FIELD.getPreferredName(), found);
if (found) {
builder.field(StoredScriptSource.TEMPLATE_PARSE_FIELD.getPreferredName(), source.getCode());
}
builder.endObject();
return new BytesRestResponse(found ? RestStatus.OK : RestStatus.NOT_FOUND, builder);
}
});
}