[英]How set scroll_size to _update_by_query request from JAVA API
I found this documentation about "update by query" request 我找到了有关“通过查询更新”请求的文档
https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-update-by-query.html https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-update-by-query.html
Question is: How add URL parameter to "_update_by_query" query: 问题是:如何在“ _update_by_query”查询中添加URL参数:
The example I add: 我添加的示例:
pre_production/_update_by_query?slices=200&scroll_size=1000 pre_production / _update_by_query?切片= 200&scroll_size = 1000
How add this 2 parameters (slices, scroll_size) usign JAVA Api? 如何添加这2个参数(切片,scroll_size)以使用Java JAVA?
You can use the UpdateByQueryRequestBuilder
instance in order to modify the number of slices: 您可以使用
UpdateByQueryRequestBuilder
实例来修改切片的数量:
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. 但是,要更改
scroll_size
参数,您需要访问基础的UpdateByQueryRequest
实例,因为该构建器没有任何setBatchSize()
方法。 You can do it like this: 您可以这样做:
((UpdateByQueryRequest) updateByQuery.getRequest()).setBatchSize(1000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.