Class DeleteByQueryRequest

java.lang.Object
org.opensearch.client.opensearch._types.RequestBase
org.opensearch.client.opensearch.core.DeleteByQueryRequest
All Implemented Interfaces:
JsonpSerializable, PlainJsonSerializable, ToCopyableBuilder<DeleteByQueryRequest.Builder,DeleteByQueryRequest>

@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") public final class DeleteByQueryRequest extends RequestBase implements PlainJsonSerializable, ToCopyableBuilder<DeleteByQueryRequest.Builder,DeleteByQueryRequest>
Deletes documents matching the provided query.
  • Field Details

  • Method Details

    • of

    • allowNoIndices

      @Nullable public final Boolean allowNoIndices()
      If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. 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

      @Nullable public final Boolean analyzeWildcard()
      If true, wildcard and prefix queries are analyzed.

      API name: analyze_wildcard

    • analyzer

      @Nullable public final String analyzer()
      Analyzer to use for the query string.

      API name: analyzer

    • conflicts

      @Nullable public final Conflicts conflicts()
      What to do if delete by query hits version conflicts: abort or proceed.

      API name: conflicts

    • defaultOperator

      @Nullable public final Operator defaultOperator()
      The default operator for query string query: AND or OR.

      API name: default_operator

    • df

      @Nullable public final String df()
      Field to use as default where no field prefix is given in the query string.

      API name: df

    • expandWildcards

      @Nonnull public final List<ExpandWildcard> expandWildcards()
      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. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

      API name: expand_wildcards

    • from

      @Nullable public final Integer from()
      Starting offset.

      API name: from

    • ignoreUnavailable

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

      API name: ignore_unavailable

    • index

      @Nonnull public final List<String> index()
      Required - Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (*). To search all data streams or indexes, omit this parameter or use * or _all.

      API name: index

    • lenient

      @Nullable public final Boolean lenient()
      If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.

      API name: lenient

    • maxDocs

      @Nullable public final Integer maxDocs()
      The maximum number of documents to delete.

      API name: max_docs

    • preference

      @Nullable public final String preference()
      Specifies the node or shard the operation should be performed on. Random by default.

      API name: preference

    • q

      @Nullable public final String q()
      Query in the Lucene query string syntax.

      API name: q

    • query

      @Nullable public final Query query()
      API name: query
    • refresh

      @Nullable public final Refresh refresh()
      If true, OpenSearch refreshes all shards involved in the delete by query after the request completes.

      API name: refresh

    • requestCache

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

      API name: request_cache

    • requestsPerSecond

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

      API name: requests_per_second

    • routing

      @Nonnull public final List<String> routing()
      Custom value used to route operations to a specific shard.

      API name: routing

    • scroll

      @Nullable public final Time scroll()
      Period to retain the search context for scrolling.

      API name: scroll

    • scrollSize

      @Nullable public final Integer scrollSize()
      Size of the scroll request that powers the operation.

      API name: scroll_size

    • searchTimeout

      @Nullable public final Time searchTimeout()
      Explicit timeout for each search request. Defaults to no timeout.

      API name: search_timeout

    • searchType

      @Nullable public final SearchType searchType()
      The type of the search operation. Available options: query_then_fetch, dfs_query_then_fetch.

      API name: search_type

    • size

      @Nullable public final Integer size()
      Deprecated, use max_docs instead.

      API name: size

    • slice

      @Nullable public final SlicedScroll slice()
      API name: slice
    • slices

      @Nullable public final Slices slices()
      The number of slices this task should be divided into.

      API name: slices

    • sort

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

      API name: sort

    • source

      @Nullable public final SourceConfigParam source()
      Set to true or false to return the _source field or not, or a list of fields to return.

      API name: _source

    • sourceExcludes

      @Nonnull public final List<String> sourceExcludes()
      List of fields to exclude from the returned _source field.

      API name: _source_excludes

    • sourceIncludes

      @Nonnull public final List<String> sourceIncludes()
      List of fields to extract and return from the _source field.

      API name: _source_includes

    • stats

      @Nonnull public final List<String> stats()
      Specific tag of the request for logging and statistical purposes.

      API name: stats

    • terminateAfter

      @Nullable public final Integer terminateAfter()
      Maximum number of documents to collect for each shard. If a query reaches this limit, OpenSearch terminates the query early. OpenSearch collects documents before sorting. Use with caution. OpenSearch applies this parameter to each shard handling the request. When possible, let OpenSearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indexes across multiple data tiers.

      API name: terminate_after

    • timeout

      @Nullable public final Time timeout()
      Period each deletion request waits for active shards.

      API name: timeout

    • version

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

      API name: version

    • waitForActiveShards

      @Nullable public final WaitForActiveShards 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).

      API name: wait_for_active_shards

    • waitForCompletion

      @Nullable public final Boolean waitForCompletion()
      If true, the request blocks until the operation is complete.

      API name: wait_for_completion

    • serialize

      public void serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Serialize this object to JSON.
      Specified by:
      serialize in interface JsonpSerializable
    • serializeInternal

      protected void serializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
    • toBuilder

      @Nonnull public DeleteByQueryRequest.Builder toBuilder()
      Description copied from interface: ToCopyableBuilder
      Create a new builder ToCopyableBuilder that is initialised with the current state of this object.
      Specified by:
      toBuilder in interface ToCopyableBuilder<DeleteByQueryRequest.Builder,DeleteByQueryRequest>
      Returns:
      a new builder instance.
    • builder

      @Nonnull public static DeleteByQueryRequest.Builder builder()
    • setupDeleteByQueryRequestDeserializer

      protected static void setupDeleteByQueryRequestDeserializer(ObjectDeserializer<DeleteByQueryRequest.Builder> op)
    • applyQueryParameters

      protected void applyQueryParameters(@Nonnull Map<String,String> params)
      Overrides:
      applyQueryParameters in class RequestBase
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object