Class UpdateByQueryRequest.Builder
- All Implemented Interfaces:
WithJson<UpdateByQueryRequest.Builder>
,ObjectBuilder<UpdateByQueryRequest>
- Enclosing class:
- UpdateByQueryRequest
UpdateByQueryRequest
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowNoIndices
(Boolean value) Iffalse
, the request returns an error if any wildcard expression, index alias, or_all
value targets only missing or closed indices.The analyzer to use for the query string.analyzeWildcard
(Boolean value) Iftrue
, wildcard and prefix queries are analyzed.build()
Builds aUpdateByQueryRequest
.The preferred behavior when update by query hits version conflicts:abort
orproceed
.defaultOperator
(Operator value) The default operator for query string query:AND
orOR
.The field to use as default where no field prefix is given in the query string.expandWildcards
(ExpandWildcard value, ExpandWildcard... values) The type of index that wildcard patterns can match.expandWildcards
(List<ExpandWildcard> list) The type of index that wildcard patterns can match.Skips the specified number of documents.ignoreUnavailable
(Boolean value) Iffalse
, the request returns an error if it targets a missing or closed index.Required - A comma-separated list of data streams, indices, and aliases to search.Required - A comma-separated list of data streams, indices, and aliases to search.Iftrue
, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.The maximum number of documents to update.The ID of the pipeline to use to preprocess incoming documents.preference
(String value) The node or shard the operation should be performed on.A query in the Lucene query string syntax.The documents to update using the Query DSL.query
(QueryVariant value) The documents to update using the Query DSL.The documents to update using the Query DSL.Iftrue
, Elasticsearch refreshes affected shards to make the operation visible to search after the request completes.requestCache
(Boolean value) Iftrue
, the request cache is used for this request.requestsPerSecond
(Float value) The throttle for this request in sub-requests per second.A custom value used to route operations to a specific shard.The script to run to update the document source or metadata when updating.The script to run to update the document source or metadata when updating.The period to retain the search context for scrolling.The period to retain the search context for scrolling.scrollSize
(Long value) The size of the scroll request that powers the operation.searchTimeout
(Time value) An explicit timeout for each search request.An explicit timeout for each search request.searchType
(SearchType value) The type of the search operation.protected UpdateByQueryRequest.Builder
self()
slice
(SlicedScroll value) Slice the request manually using the provided slice ID and total number of slices.Slice the request manually using the provided slice ID and total number of slices.The number of slices this task should be divided into.The number of slices this task should be divided into.A comma-separated list of <field>:<direction> pairs.A comma-separated list of <field>:<direction> pairs.The specifictag
of the request for logging and statistical purposes.The specifictag
of the request for logging and statistical purposes.terminateAfter
(Long value) The maximum number of documents to collect for each shard.The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards.The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards.Iftrue
, returns the document version as part of a hit.versionType
(Boolean value) Should the document increment the version number (internal) on hit or not (reindex)The number of shard copies that must be active before proceeding with the operation.The number of shard copies that must be active before proceeding with the operation.waitForCompletion
(Boolean value) Iftrue
, the request blocks until the operation is complete.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJson
Methods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
allowNoIndices
Iffalse
, the request returns an error if any wildcard expression, index alias, or_all
value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*
returns an error if an index starts withfoo
but no index starts withbar
.API name:
allow_no_indices
-
analyzeWildcard
Iftrue
, wildcard and prefix queries are analyzed. This parameter can be used only when theq
query string parameter is specified.API name:
analyze_wildcard
-
analyzer
The analyzer to use for the query string. This parameter can be used only when theq
query string parameter is specified.API name:
analyzer
-
conflicts
The preferred behavior when update by query hits version conflicts:abort
orproceed
.API name:
conflicts
-
defaultOperator
The default operator for query string query:AND
orOR
. This parameter can be used only when theq
query string parameter is specified.API name:
default_operator
-
df
The field to use as default where no field prefix is given in the query string. This parameter can be used only when theq
query string parameter is specified.API name:
df
-
expandWildcards
The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such asopen,hidden
. Valid values are:all
,open
,closed
,hidden
,none
.API name:
expand_wildcards
Adds all elements of
list
toexpandWildcards
. -
expandWildcards
public final UpdateByQueryRequest.Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such asopen,hidden
. Valid values are:all
,open
,closed
,hidden
,none
.API name:
expand_wildcards
Adds one or more values to
expandWildcards
. -
from
Skips the specified number of documents.API name:
from
-
index
Required - A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*
). To search all data streams or indices, omit this parameter or use*
or_all
.API name:
index
Adds all elements of
list
toindex
. -
index
Required - A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*
). To search all data streams or indices, omit this parameter or use*
or_all
.API name:
index
Adds one or more values to
index
. -
lenient
Iftrue
, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when theq
query string parameter is specified.API name:
lenient
-
maxDocs
The maximum number of documents to update.API name:
max_docs
-
pipeline
The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to_none
disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter.API name:
pipeline
-
preference
The node or shard the operation should be performed on. It is random by default.API name:
preference
-
q
A query in the Lucene query string syntax.API name:
q
-
query
The documents to update using the Query DSL.API name:
query
-
query
The documents to update using the Query DSL.API name:
query
-
query
The documents to update using the Query DSL.API name:
query
-
refresh
Iftrue
, Elasticsearch refreshes affected shards to make the operation visible to search after the request completes. This is different than the update API'srefresh
parameter, which causes just the shard that received the request to be refreshed.API name:
refresh
-
requestCache
Iftrue
, the request cache is used for this request. It defaults to the index-level setting.API name:
request_cache
-
requestsPerSecond
The throttle for this request in sub-requests per second.API name:
requests_per_second
-
routing
A custom value used to route operations to a specific shard.API name:
routing
-
script
The script to run to update the document source or metadata when updating.API name:
script
-
script
The script to run to update the document source or metadata when updating.API name:
script
-
scroll
The period to retain the search context for scrolling.API name:
scroll
-
scroll
The period to retain the search context for scrolling.API name:
scroll
-
scrollSize
The size of the scroll request that powers the operation.API name:
scroll_size
-
searchTimeout
An explicit timeout for each search request. By default, there is no timeout.API name:
search_timeout
-
searchTimeout
public final UpdateByQueryRequest.Builder searchTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) An explicit timeout for each search request. By default, there is no timeout.API name:
search_timeout
-
searchType
The type of the search operation. Available options includequery_then_fetch
anddfs_query_then_fetch
.API name:
search_type
-
slice
Slice the request manually using the provided slice ID and total number of slices.API name:
slice
-
slice
public final UpdateByQueryRequest.Builder slice(Function<SlicedScroll.Builder, ObjectBuilder<SlicedScroll>> fn) Slice the request manually using the provided slice ID and total number of slices.API name:
slice
-
slices
The number of slices this task should be divided into.API name:
slices
-
slices
The number of slices this task should be divided into.API name:
slices
-
sort
A comma-separated list of <field>:<direction> pairs.API name:
sort
Adds all elements of
list
tosort
. -
sort
A comma-separated list of <field>:<direction> pairs.API name:
sort
Adds one or more values to
sort
. -
stats
The specifictag
of the request for logging and statistical purposes.API name:
stats
Adds all elements of
list
tostats
. -
stats
The specifictag
of the request for logging and statistical purposes.API name:
stats
Adds one or more values to
stats
. -
terminateAfter
The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.IMPORTANT: Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.
API name:
terminate_after
-
timeout
The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. By default, it is one minute. This guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur.API name:
timeout
-
timeout
The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. By default, it is one minute. This guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur.API name:
timeout
-
version
Iftrue
, returns the document version as part of a hit.API name:
version
-
versionType
Should the document increment the version number (internal) on hit or not (reindex)API name:
version_type
-
waitForActiveShards
The number of shard copies that must be active before proceeding with the operation. Set toall
or any positive integer up to the total number of shards in the index (number_of_replicas+1
). Thetimeout
parameter controls how long each write request waits for unavailable shards to become available. Both work exactly the way they work in the bulk API.API name:
wait_for_active_shards
-
waitForActiveShards
public final UpdateByQueryRequest.Builder waitForActiveShards(Function<WaitForActiveShards.Builder, ObjectBuilder<WaitForActiveShards>> fn) The number of shard copies that must be active before proceeding with the operation. Set toall
or any positive integer up to the total number of shards in the index (number_of_replicas+1
). Thetimeout
parameter controls how long each write request waits for unavailable shards to become available. Both work exactly the way they work in the bulk API.API name:
wait_for_active_shards
-
waitForCompletion
Iftrue
, the request blocks until the operation is complete. Iffalse
, Elasticsearch performs some preflight checks, launches the request, and returns a task ID that you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at.tasks/task/${taskId}
.API name:
wait_for_completion
-
self
- Specified by:
self
in classRequestBase.AbstractBuilder<UpdateByQueryRequest.Builder>
-
build
Builds aUpdateByQueryRequest
.- Specified by:
build
in interfaceObjectBuilder<UpdateByQueryRequest>
- Throws:
NullPointerException
- if some of the required fields are null.
-