我正在寻找一种从Java客户端使用吞食附件处理器插件的方法。
您似乎需要执行两个步骤,即首先定义包含附件处理器的管道(例如,引用字段数据和使用管道id附件)。
PUT _ingest/pipeline/attachment
{
"description" : "Extract attachment information",
"processors" : [
{
"attachment" : {
"field" : "data"
}
}
]
}然后将数据引用到字段(这里是数据)和管道(这里是附件)。
PUT my_index/my_type/my_id?pipeline=attachment
{
"data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}现在,我想从Java高级REST客户机执行这两个步骤。我似乎可以使用管道API执行第一步(管道的定义),但是我找不到第二部分的Java机制,即在引用管道的同时写入实际数据。
发布于 2019-01-12 14:06:57
在Java高级REST客户机中,有一种使用IndexRequest进行索引的方法,在创建过程中,可以通过Java设置管道。
我希望有这样的代码:
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost", 9200, "http")));
final IndexRequest indexRequest = new IndexRequest("index-name", "index-type");
indexRequest.setPipeline("pipeline-name");
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("data", "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=");
indexRequest.source(jsonMap);
final IndexResponse indexResponse = client.index(indexRequest);https://stackoverflow.com/questions/54135989
复制相似问题