Class BulkRequest.Builder<TSource>

java.lang.Object
co.elastic.clients.elasticsearch._core.BulkRequest.Builder<TSource>
All Implemented Interfaces:
ObjectBuilder<BulkRequest<TSource>>
Enclosing class:
BulkRequest<TSource>

public static class BulkRequest.Builder<TSource>
extends java.lang.Object
implements ObjectBuilder<BulkRequest<TSource>>
Builder for BulkRequest.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • index

      public BulkRequest.Builder<TSource> index​(@Nullable java.lang.String value)
      Default index for items which don't provide one

      API name: index

    • type

      public BulkRequest.Builder<TSource> type​(@Nullable java.lang.String value)
      Default document type for items which don't provide one

      API name: type

    • pipeline

      public BulkRequest.Builder<TSource> pipeline​(@Nullable java.lang.String value)
      The pipeline id to preprocess incoming documents with

      API name: pipeline

    • refresh

      public BulkRequest.Builder<TSource> refresh​(@Nullable jakarta.json.JsonValue value)
      If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

      API name: refresh

    • routing

      public BulkRequest.Builder<TSource> routing​(@Nullable java.lang.String value)
      Specific routing value

      API name: routing

    • source

      public BulkRequest.Builder<TSource> source​(@Nullable jakarta.json.JsonValue value)
      True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request

      API name: _source

    • sourceExcludes

      public BulkRequest.Builder<TSource> sourceExcludes​(@Nullable java.util.List<java.lang.String> value)
      Default list of fields to exclude from the returned _source field, can be overridden on each sub-request

      API name: _source_excludes

    • sourceExcludes

      public BulkRequest.Builder<TSource> sourceExcludes​(java.lang.String... value)
      Default list of fields to exclude from the returned _source field, can be overridden on each sub-request

      API name: _source_excludes

    • addSourceExcludes

      public BulkRequest.Builder<TSource> addSourceExcludes​(java.lang.String value)
      Add a value to sourceExcludes(List), creating the list if needed.
    • sourceIncludes

      public BulkRequest.Builder<TSource> sourceIncludes​(@Nullable java.util.List<java.lang.String> value)
      Default list of fields to extract and return from the _source field, can be overridden on each sub-request

      API name: _source_includes

    • sourceIncludes

      public BulkRequest.Builder<TSource> sourceIncludes​(java.lang.String... value)
      Default list of fields to extract and return from the _source field, can be overridden on each sub-request

      API name: _source_includes

    • addSourceIncludes

      public BulkRequest.Builder<TSource> addSourceIncludes​(java.lang.String value)
      Add a value to sourceIncludes(List), creating the list if needed.
    • timeout

      public BulkRequest.Builder<TSource> timeout​(@Nullable java.lang.String value)
      Explicit operation timeout

      API name: timeout

    • waitForActiveShards

      public BulkRequest.Builder<TSource> waitForActiveShards​(@Nullable jakarta.json.JsonValue value)
      Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

      API name: wait_for_active_shards

    • requireAlias

      public BulkRequest.Builder<TSource> requireAlias​(@Nullable java.lang.Boolean value)
      Sets require_alias for all incoming documents. Defaults to unset (false)

      API name: require_alias

    • operations

      public BulkRequest.Builder<TSource> operations​(java.util.List<java.lang.Object> value)
      Required - Request body.

      API name: _value_body

    • operations

      public BulkRequest.Builder<TSource> operations​(java.lang.Object... value)
      Required - Request body.

      API name: _value_body

    • addOperation

      public BulkRequest.Builder<TSource> addOperation​(Operation value)
      Add an Operation to operations(List), creating the list if needed.
    • addDocument

      public BulkRequest.Builder<TSource> addDocument​(TSource value)
      Add a document to operations(List), creating the list if needed.
    • addOperation

      public BulkRequest.Builder<TSource> addOperation​(java.util.function.Function<Operation.Builder,​ObjectBuilder<Operation>> fn)
      Add an Operation to operations(List), creating the list if needed.
    • tSourceSerializer

      public BulkRequest.Builder<TSource> tSourceSerializer​(@Nullable JsonpSerializer<TSource> value)
      Serializer for TSource. If not set, an attempt will be made to find a serializer from the JSON context.
    • build

      public BulkRequest<TSource> build()
      Builds a BulkRequest.
      Specified by:
      build in interface ObjectBuilder<TSource>
      Throws:
      java.lang.NullPointerException - if some of the required fields are null.