當前位置: 首頁>>代碼示例>>Java>>正文


Java Script.DEFAULT_TEMPLATE_LANG屬性代碼示例

本文整理匯總了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));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:8,代碼來源:RestPutSearchTemplateAction.java

示例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));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:7,代碼來源:RestDeleteSearchTemplateAction.java

示例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);
        }
    });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:28,代碼來源:RestGetSearchTemplateAction.java


注:本文中的org.elasticsearch.script.Script.DEFAULT_TEMPLATE_LANG屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。