Class UpdateByQueryRequest.Builder

All Implemented Interfaces:
WithJson<UpdateByQueryRequest.Builder>, ObjectBuilder<UpdateByQueryRequest>
Enclosing class:
UpdateByQueryRequest

public static class UpdateByQueryRequest.Builder extends RequestBase.AbstractBuilder<UpdateByQueryRequest.Builder> implements ObjectBuilder<UpdateByQueryRequest>
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • allowNoIndices

      public final UpdateByQueryRequest.Builder allowNoIndices(@Nullable Boolean value)
      If false, 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 targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.

      API name: allow_no_indices

    • analyzeWildcard

      public final UpdateByQueryRequest.Builder analyzeWildcard(@Nullable Boolean value)
      If true, wildcard and prefix queries are analyzed. This parameter can be used only when the q query string parameter is specified.

      API name: analyze_wildcard

    • analyzer

      public final UpdateByQueryRequest.Builder analyzer(@Nullable String value)
      The analyzer to use for the query string. This parameter can be used only when the q query string parameter is specified.

      API name: analyzer

    • conflicts

      public final UpdateByQueryRequest.Builder conflicts(@Nullable Conflicts value)
      The preferred behavior when update by query hits version conflicts: abort or proceed.

      API name: conflicts

    • defaultOperator

      public final UpdateByQueryRequest.Builder defaultOperator(@Nullable Operator value)
      The default operator for query string query: AND or OR. This parameter can be used only when the q query string parameter is specified.

      API name: default_operator

    • df

      public final UpdateByQueryRequest.Builder df(@Nullable String value)
      The field to use as default where no field prefix is given in the query string. This parameter can be used only when the q query string parameter is specified.

      API name: df

    • expandWildcards

      public final UpdateByQueryRequest.Builder expandWildcards(List<ExpandWildcard> list)
      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 as open,hidden. Valid values are: all, open, closed, hidden, none.

      API name: expand_wildcards

      Adds all elements of list to expandWildcards.

    • 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 as open,hidden. Valid values are: all, open, closed, hidden, none.

      API name: expand_wildcards

      Adds one or more values to expandWildcards.

    • from

      public final UpdateByQueryRequest.Builder from(@Nullable Long value)
      Skips the specified number of documents.

      API name: from

    • ignoreUnavailable

      public final UpdateByQueryRequest.Builder ignoreUnavailable(@Nullable Boolean value)
      If false, the request returns an error if it targets a missing or closed index.

      API name: ignore_unavailable

    • index

      public final UpdateByQueryRequest.Builder index(List<String> list)
      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 to index.

    • index

      public final UpdateByQueryRequest.Builder index(String value, String... values)
      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

      public final UpdateByQueryRequest.Builder lenient(@Nullable Boolean value)
      If true, 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 the q query string parameter is specified.

      API name: lenient

    • maxDocs

      public final UpdateByQueryRequest.Builder maxDocs(@Nullable Long value)
      The maximum number of documents to update.

      API name: max_docs

    • pipeline

      public final UpdateByQueryRequest.Builder pipeline(@Nullable String value)
      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

      public final UpdateByQueryRequest.Builder preference(@Nullable String value)
      The node or shard the operation should be performed on. It is random by default.

      API name: preference

    • q

      public final UpdateByQueryRequest.Builder q(@Nullable String value)
      A query in the Lucene query string syntax.

      API name: q

    • query

      public final UpdateByQueryRequest.Builder query(@Nullable Query value)
      The documents to update using the Query DSL.

      API name: query

    • query

      The documents to update using the Query DSL.

      API name: query

    • query

      public final UpdateByQueryRequest.Builder query(QueryVariant value)
      The documents to update using the Query DSL.

      API name: query

    • refresh

      public final UpdateByQueryRequest.Builder refresh(@Nullable Boolean value)
      If true, Elasticsearch refreshes affected shards to make the operation visible to search after the request completes. This is different than the update API's refresh parameter, which causes just the shard that received the request to be refreshed.

      API name: refresh

    • requestCache

      public final UpdateByQueryRequest.Builder requestCache(@Nullable Boolean value)
      If true, the request cache is used for this request. It defaults to the index-level setting.

      API name: request_cache

    • requestsPerSecond

      public final UpdateByQueryRequest.Builder requestsPerSecond(@Nullable Float value)
      The throttle for this request in sub-requests per second.

      API name: requests_per_second

    • routing

      public final UpdateByQueryRequest.Builder routing(@Nullable String value)
      A custom value used to route operations to a specific shard.

      API name: routing

    • script

      public final UpdateByQueryRequest.Builder script(@Nullable Script value)
      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

      public final UpdateByQueryRequest.Builder scroll(@Nullable Time value)
      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

      public final UpdateByQueryRequest.Builder scrollSize(@Nullable Long value)
      The size of the scroll request that powers the operation.

      API name: scroll_size

    • searchTimeout

      public final UpdateByQueryRequest.Builder searchTimeout(@Nullable Time value)
      An explicit timeout for each search request. By default, there is no timeout.

      API name: search_timeout

    • searchTimeout

      An explicit timeout for each search request. By default, there is no timeout.

      API name: search_timeout

    • searchType

      public final UpdateByQueryRequest.Builder searchType(@Nullable SearchType value)
      The type of the search operation. Available options include query_then_fetch and dfs_query_then_fetch.

      API name: search_type

    • slice

      public final UpdateByQueryRequest.Builder slice(@Nullable SlicedScroll value)
      Slice the request manually using the provided slice ID and total number of slices.

      API name: slice

    • slice

      Slice the request manually using the provided slice ID and total number of slices.

      API name: slice

    • slices

      public final UpdateByQueryRequest.Builder slices(@Nullable Slices value)
      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

      public final UpdateByQueryRequest.Builder sort(List<String> list)
      A comma-separated list of <field>:<direction> pairs.

      API name: sort

      Adds all elements of list to sort.

    • sort

      public final UpdateByQueryRequest.Builder sort(String value, String... values)
      A comma-separated list of <field>:<direction> pairs.

      API name: sort

      Adds one or more values to sort.

    • stats

      public final UpdateByQueryRequest.Builder stats(List<String> list)
      The specific tag of the request for logging and statistical purposes.

      API name: stats

      Adds all elements of list to stats.

    • stats

      public final UpdateByQueryRequest.Builder stats(String value, String... values)
      The specific tag of the request for logging and statistical purposes.

      API name: stats

      Adds one or more values to stats.

    • terminateAfter

      public final UpdateByQueryRequest.Builder terminateAfter(@Nullable Long value)
      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

      public final UpdateByQueryRequest.Builder timeout(@Nullable Time value)
      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

      public final UpdateByQueryRequest.Builder version(@Nullable Boolean value)
      If true, returns the document version as part of a hit.

      API name: version

    • versionType

      public final UpdateByQueryRequest.Builder versionType(@Nullable Boolean value)
      Should the document increment the version number (internal) on hit or not (reindex)

      API name: version_type

    • waitForActiveShards

      public final UpdateByQueryRequest.Builder waitForActiveShards(@Nullable WaitForActiveShards value)
      The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). The timeout 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

      The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). The timeout 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

      public final UpdateByQueryRequest.Builder waitForCompletion(@Nullable Boolean value)
      If true, the request blocks until the operation is complete. If false, 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

      protected UpdateByQueryRequest.Builder self()
      Specified by:
      self in class RequestBase.AbstractBuilder<UpdateByQueryRequest.Builder>
    • build

      public UpdateByQueryRequest build()
      Specified by:
      build in interface ObjectBuilder<UpdateByQueryRequest>
      Throws:
      NullPointerException - if some of the required fields are null.