[[reference-shared-types--global-bulk]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////



== Shared Bulk types


[discrete]
[[BulkCreateOperation]]
=== BulkCreateOperation

[pass]
++++
<pre>
++++
interface BulkCreateOperation extends <<BulkWriteOperation>> {
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkDeleteOperation]]
=== BulkDeleteOperation

[pass]
++++
<pre>
++++
interface BulkDeleteOperation extends <<BulkOperationBase>> {
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkIndexOperation]]
=== BulkIndexOperation

[pass]
++++
<pre>
++++
interface BulkIndexOperation extends <<BulkWriteOperation>> {
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkOperationBase]]
=== BulkOperationBase

[pass]
++++
<pre>
++++
interface BulkOperationBase {
  pass:[/**] @property _id The document ID. */
  _id?: <<Id>>
  pass:[/**] @property _index <<Name>> of the index or index alias to perform the action on. */
  _index?: <<IndexName>>
  pass:[/**] @property routing Custom value used to route operations to a specific shard. */
  routing?: <<Routing>>
  if_primary_term?: <<long>>
  if_seq_no?: <<SequenceNumber>>
  version?: <<VersionNumber>>
  version_type?: <<VersionType>>
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkOperationContainer]]
=== BulkOperationContainer

[pass]
++++
<pre>
++++
interface BulkOperationContainer {
  pass:[/**] @property index Indexes the specified document. If the document exists, replaces the document and increments the version. The following line must contain the source data to be indexed. */
  index?: <<BulkIndexOperation>>
  pass:[/**] @property create Indexes the specified document if it does not already exist. The following line must contain the source data to be indexed. */
  create?: <<BulkCreateOperation>>
  pass:[/**] @property update Performs a partial document update. The following line must contain the partial document and update options. */
  update?: <<BulkUpdateOperation>>
  pass:[/**] @property delete Removes the specified document from the index. */
  delete?: <<BulkDeleteOperation>>
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkOperationType]]
=== BulkOperationType

[pass]
++++
<pre>
++++
type BulkOperationType = 'index' | 'create' | 'update' | 'delete'
[pass]
++++
</pre>
++++

[discrete]
[[BulkRequest]]
=== BulkRequest

[pass]
++++
<pre>
++++
interface BulkRequest<TDocument = unknown, TPartialDocument = unknown> extends <<RequestBase>> {
  index?: <<IndexName>>
  pipeline?: string
  refresh?: <<Refresh>>
  routing?: <<Routing>>
  _source?: <<SearchSourceConfigParam>>
  _source_excludes?: <<Fields>>
  _source_includes?: <<Fields>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
  require_alias?: boolean
  operations?: (<<BulkOperationContainer>> | <<BulkUpdateAction>><TDocument, TPartialDocument> | TDocument)[]
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkResponse]]
=== BulkResponse

[pass]
++++
<pre>
++++
interface BulkResponse {
  errors: boolean
  items: Partial<Record<<<BulkOperationType>>, <<BulkResponseItem>>>>[]
  took: <<long>>
  ingest_took?: <<long>>
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkResponseItem]]
=== BulkResponseItem

[pass]
++++
<pre>
++++
interface BulkResponseItem {
  pass:[/**] @property _id The document ID associated with the operation. */
  _id?: string | null
  pass:[/**] @property _index <<Name>> of the index associated with the operation. If the operation targeted a data stream, this is the backing index into which the document was written. */
  _index: string
  pass:[/**] @property status HTTP status code returned for the operation. */
  status: <<integer>>
  pass:[/**] @property error Contains additional information about the failed operation. The parameter is only returned for failed operations. */
  error?: <<ErrorCause>>
  pass:[/**] @property _primary_term The primary term assigned to the document for the operation. */
  _primary_term?: <<long>>
  pass:[/**] @property result <<Result>> of the operation. Successful values are `created`, `deleted`, and `updated`. */
  result?: string
  pass:[/**] @property _seq_no The sequence number assigned to the document for the operation. Sequence numbers are used to ensure an older version of a document doesn’t overwrite a newer version. */
  _seq_no?: <<SequenceNumber>>
  pass:[/**] @property _shards Contains shard information for the operation. */
  _shards?: <<ShardStatistics>>
  pass:[/**] @property _version The document version associated with the operation. The document version is incremented each time the document is updated. */
  _version?: <<VersionNumber>>
  forced_refresh?: boolean
  get?: <<InlineGet>><Record<string, any>>
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkUpdateAction]]
=== BulkUpdateAction

[pass]
++++
<pre>
++++
interface BulkUpdateAction<TDocument = unknown, TPartialDocument = unknown> {
  pass:[/**] @property detect_noop Set to false to disable setting 'result' in the response to 'noop' if no change to the document occurred. */
  detect_noop?: boolean
  pass:[/**] @property doc A partial update to an existing document. */
  doc?: TPartialDocument
  pass:[/**] @property doc_as_upsert Set to true to use the contents of 'doc' as the value of 'upsert' */
  doc_as_upsert?: boolean
  pass:[/**] @property script <<Script>> to execute to update the document. */
  script?: <<Script>> | string
  pass:[/**] @property scripted_upsert Set to true to execute the script whether or not the document exists. */
  scripted_upsert?: boolean
  pass:[/**] @property _source Set to false to disable source retrieval. You can also specify a comma-separated list of the fields you want to retrieve. */
  _source?: <<SearchSourceConfig>>
  pass:[/**] @property upsert If the document does not already exist, the contents of 'upsert' are inserted as a new document. If the document exists, the 'script' is executed. */
  upsert?: TDocument
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkUpdateOperation]]
=== BulkUpdateOperation

[pass]
++++
<pre>
++++
interface BulkUpdateOperation extends <<BulkOperationBase>> {
  pass:[/**] @property require_alias If `true`, the request’s actions must target an index alias. */
  require_alias?: boolean
  retry_on_conflict?: <<integer>>
}
[pass]
++++
</pre>
++++

[discrete]
[[BulkWriteOperation]]
=== BulkWriteOperation

[pass]
++++
<pre>
++++
interface BulkWriteOperation extends <<BulkOperationBase>> {
  pass:[/**] @property dynamic_templates A map from the full name of fields to the name of dynamic templates. Defaults to an empty map. If a name matches a dynamic template, then that template will be applied regardless of other match predicates defined in the template. If a field is already defined in the mapping, then this parameter won’t be used. */
  dynamic_templates?: Record<string, string>
  pass:[/**] @property pipeline 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. */
  pipeline?: string
  pass:[/**] @property require_alias If `true`, the request’s actions must target an index alias. */
  require_alias?: boolean
}
[pass]
++++
</pre>
++++
