Class CreateRequest<TDocument>

java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch.core.CreateRequest<TDocument>
All Implemented Interfaces:
JsonpSerializable

@JsonpDeserializable public class CreateRequest<TDocument> extends RequestBase implements JsonpSerializable
Creates a new document in the index.

Returns a 409 response when a document with a same ID already exists in the index.

See Also:
  • Field Details

  • Method Details

    • of

      public static <TDocument> CreateRequest<TDocument> of(Function<CreateRequest.Builder<TDocument>,ObjectBuilder<CreateRequest<TDocument>>> fn)
    • id

      public final String id()
      Required - Document ID

      API name: id

    • index

      public final String index()
      Required - The name of the index

      API name: index

    • pipeline

      @Nullable public final String pipeline()
      The pipeline id to preprocess incoming documents with

      API name: pipeline

    • refresh

      @Nullable public final Refresh refresh()
      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

      @Nullable public final String routing()
      Specific routing value

      API name: routing

    • timeout

      @Nullable public final Time timeout()
      Explicit operation timeout

      API name: timeout

    • version

      @Nullable public final Long version()
      Explicit version number for concurrency control

      API name: version

    • versionType

      @Nullable public final VersionType versionType()
      Specific version type

      API name: version_type

    • waitForActiveShards

      @Nullable public final WaitForActiveShards waitForActiveShards()
      Sets the number of shard copies that must be active before proceeding with the index 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

    • document

      public final TDocument document()
      Required - Request body.
    • serialize

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

      public static <TDocument> JsonpDeserializer<CreateRequest<TDocument>> createCreateRequestDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer)