我找到了有关“通过查询更新”请求的文档
https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-update-by-query.html
问题是:如何在“ _update_by_query”查询中添加URL参数:
我添加的示例:
pre_production / _update_by_query?slices = 200&scroll_size = 1000
如何添加这两个参数(切片,scroll_size)以使用JAVA Api?
答案 0 :(得分:1)
You can use the UpdateByQueryRequestBuilder
instance in order to modify the number of slices:
UpdateByQueryRequestBuilder updateByQuery =
UpdateByQueryAction.INSTANCE.newRequestBuilder(client);
updateByQuery.source("source_index")
.source()
.setSlices(200); <--- set the number of slices
However, to change the scroll_size
parameter you need to access the underlying UpdateByQueryRequest
instance as the builder doesn't have any setBatchSize()
method. You can do it like this:
((UpdateByQueryRequest) updateByQuery.getRequest()).setBatchSize(1000);