elasticsearch管道創建java API

public boolean putPipelineApi(String pipeId) throws IOException {
        String source =
                "{\"description\":\"my set of processors\"," +
                        "\"processors\":[{\"attachment\":{\"field\":\"data\",\"indexed_chars\":\"-1\"}}]}";
        PutPipelineRequest request = new PutPipelineRequest(
                pipeId,
                new BytesArray(source.getBytes(StandardCharsets.UTF_8)),
                XContentType.JSON
        );

        AcknowledgedResponse response = restHighLevelClient.ingest().putPipeline(request, RequestOptions.DEFAULT);
        logger.info("管道創建接口執行完畢,{}", response.isAcknowledged());
        return response.isAcknowledged();
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章