Class BulkRequest.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • source

      public final BulkRequest.Builder source(@Nullable SourceConfigParam value)
      Indicates whether to return the _source field (true or false) or contains a list of fields to return.

      API name: _source

    • source

      Indicates whether to return the _source field (true or false) or contains a list of fields to return.

      API name: _source

    • sourceExcludes

      public final BulkRequest.Builder sourceExcludes(List<String> list)
      A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. If the _source parameter is false, this parameter is ignored.

      API name: _source_excludes

      Adds all elements of list to sourceExcludes.

    • sourceExcludes

      public final BulkRequest.Builder sourceExcludes(String value, String... values)
      A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. If the _source parameter is false, this parameter is ignored.

      API name: _source_excludes

      Adds one or more values to sourceExcludes.

    • sourceIncludes

      public final BulkRequest.Builder sourceIncludes(List<String> list)
      A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. If the _source parameter is false, this parameter is ignored.

      API name: _source_includes

      Adds all elements of list to sourceIncludes.

    • sourceIncludes

      public final BulkRequest.Builder sourceIncludes(String value, String... values)
      A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. If the _source parameter is false, this parameter is ignored.

      API name: _source_includes

      Adds one or more values to sourceIncludes.

    • includeSourceOnError

      public final BulkRequest.Builder includeSourceOnError(@Nullable Boolean value)
      True or false if to include the document source in the error message in case of parsing errors.

      API name: include_source_on_error

    • index

      public final BulkRequest.Builder index(@Nullable String value)
      The name of the data stream, index, or index alias to perform bulk actions on.

      API name: index

    • listExecutedPipelines

      public final BulkRequest.Builder listExecutedPipelines(@Nullable Boolean value)
      If true, the response will include the ingest pipelines that were run for each index or create.

      API name: list_executed_pipelines

    • pipeline

      public final BulkRequest.Builder pipeline(@Nullable String value)
      The pipeline identifier to use to preprocess incoming documents. If the index has a default ingest pipeline specified, setting the value to _none turns off 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

    • refresh

      public final BulkRequest.Builder refresh(@Nullable Refresh value)
      If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If wait_for, wait for a refresh to make this operation visible to search. If false, do nothing with refreshes. Valid values: true, false, wait_for.

      API name: refresh

    • requireAlias

      public final BulkRequest.Builder requireAlias(@Nullable Boolean value)
      If true, the request's actions must target an index alias.

      API name: require_alias

    • requireDataStream

      public final BulkRequest.Builder requireDataStream(@Nullable Boolean value)
      If true, the request's actions must target a data stream (existing or to be created).

      API name: require_data_stream

    • routing

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

      API name: routing

    • timeout

      public final BulkRequest.Builder timeout(@Nullable Time value)
      The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. The default is 1m (one minute), which 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 action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. The default is 1m (one minute), which 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

    • waitForActiveShards

      public final BulkRequest.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 default is 1, which waits for each primary shard to be active.

      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 default is 1, which waits for each primary shard to be active.

      API name: wait_for_active_shards

    • operations

      public final BulkRequest.Builder operations(List<BulkOperation> list)
      Required - Request body.

      Adds all elements of list to operations.

    • operations

      public final BulkRequest.Builder operations(BulkOperation value, BulkOperation... values)
      Required - Request body.

      Adds one or more values to operations.

    • operations

      public final BulkRequest.Builder operations(BulkOperationVariant value, BulkOperationVariant... values)
      Required - Request body.

      Adds one or more values to operations.

    • operations

      Required - Request body.

      Adds a value to operations using a builder lambda.

    • self

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

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