diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 5a279ee9ab..28d1627ed9 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -7451,15 +7451,30 @@ { "$ref": "#/components/parameters/create#id" }, + { + "$ref": "#/components/parameters/create#if_primary_term" + }, + { + "$ref": "#/components/parameters/create#if_seq_no" + }, { "$ref": "#/components/parameters/create#include_source_on_error" }, + { + "$ref": "#/components/parameters/create#op_type" + }, { "$ref": "#/components/parameters/create#pipeline" }, { "$ref": "#/components/parameters/create#refresh" }, + { + "$ref": "#/components/parameters/create#require_alias" + }, + { + "$ref": "#/components/parameters/create#require_data_stream" + }, { "$ref": "#/components/parameters/create#routing" }, @@ -7503,15 +7518,30 @@ { "$ref": "#/components/parameters/create#id" }, + { + "$ref": "#/components/parameters/create#if_primary_term" + }, + { + "$ref": "#/components/parameters/create#if_seq_no" + }, { "$ref": "#/components/parameters/create#include_source_on_error" }, + { + "$ref": "#/components/parameters/create#op_type" + }, { "$ref": "#/components/parameters/create#pipeline" }, { "$ref": "#/components/parameters/create#refresh" }, + { + "$ref": "#/components/parameters/create#require_alias" + }, + { + "$ref": "#/components/parameters/create#require_data_stream" + }, { "$ref": "#/components/parameters/create#routing" }, @@ -71457,6 +71487,13 @@ "scheduled" ] }, + "_types:OpType": { + "type": "string", + "enum": [ + "index", + "create" + ] + }, "_types:WriteResponseBase": { "type": "object", "properties": { @@ -73893,13 +73930,6 @@ "phase" ] }, - "_types:OpType": { - "type": "string", - "enum": [ - "index", - "create" - ] - }, "indices.add_block:IndicesBlockOptions": { "type": "string", "enum": [ @@ -104093,6 +104123,26 @@ }, "style": "simple" }, + "create#if_primary_term": { + "in": "query", + "name": "if_primary_term", + "description": "Only perform the operation if the document has this primary term.", + "deprecated": false, + "schema": { + "type": "number" + }, + "style": "form" + }, + "create#if_seq_no": { + "in": "query", + "name": "if_seq_no", + "description": "Only perform the operation if the document has this sequence number.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:SequenceNumber" + }, + "style": "form" + }, "create#include_source_on_error": { "in": "query", "name": "include_source_on_error", @@ -104103,6 +104153,16 @@ }, "style": "form" }, + "create#op_type": { + "in": "query", + "name": "op_type", + "description": "Set to `create` to only index the document if it does not already exist (put if absent).\nIf a document with the specified `_id` already exists, the indexing operation will fail.\nThe behavior is the same as using the `/_create` endpoint.\nIf a document ID is specified, this paramater defaults to `index`.\nOtherwise, it defaults to `create`.\nIf the request targets a data stream, an `op_type` of `create` is required.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:OpType" + }, + "style": "form" + }, "create#pipeline": { "in": "query", "name": "pipeline", @@ -104123,6 +104183,26 @@ }, "style": "form" }, + "create#require_alias": { + "in": "query", + "name": "require_alias", + "description": "If `true`, the destination must be an index alias.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + "create#require_data_stream": { + "in": "query", + "name": "require_data_stream", + "description": "If `true`, the request's actions must target a data stream (existing or to be created).", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, "create#routing": { "in": "query", "name": "routing", diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 9a3fa06eca..c2280de6c6 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -3678,15 +3678,30 @@ { "$ref": "#/components/parameters/create#id" }, + { + "$ref": "#/components/parameters/create#if_primary_term" + }, + { + "$ref": "#/components/parameters/create#if_seq_no" + }, { "$ref": "#/components/parameters/create#include_source_on_error" }, + { + "$ref": "#/components/parameters/create#op_type" + }, { "$ref": "#/components/parameters/create#pipeline" }, { "$ref": "#/components/parameters/create#refresh" }, + { + "$ref": "#/components/parameters/create#require_alias" + }, + { + "$ref": "#/components/parameters/create#require_data_stream" + }, { "$ref": "#/components/parameters/create#routing" }, @@ -3730,15 +3745,30 @@ { "$ref": "#/components/parameters/create#id" }, + { + "$ref": "#/components/parameters/create#if_primary_term" + }, + { + "$ref": "#/components/parameters/create#if_seq_no" + }, { "$ref": "#/components/parameters/create#include_source_on_error" }, + { + "$ref": "#/components/parameters/create#op_type" + }, { "$ref": "#/components/parameters/create#pipeline" }, { "$ref": "#/components/parameters/create#refresh" }, + { + "$ref": "#/components/parameters/create#require_alias" + }, + { + "$ref": "#/components/parameters/create#require_data_stream" + }, { "$ref": "#/components/parameters/create#routing" }, @@ -46048,6 +46078,13 @@ "scheduled" ] }, + "_types:OpType": { + "type": "string", + "enum": [ + "index", + "create" + ] + }, "_types:WriteResponseBase": { "type": "object", "properties": { @@ -46902,13 +46939,6 @@ "weight" ] }, - "_types:OpType": { - "type": "string", - "enum": [ - "index", - "create" - ] - }, "indices.add_block:IndicesBlockOptions": { "type": "string", "enum": [ @@ -61272,6 +61302,26 @@ }, "style": "simple" }, + "create#if_primary_term": { + "in": "query", + "name": "if_primary_term", + "description": "Only perform the operation if the document has this primary term.", + "deprecated": false, + "schema": { + "type": "number" + }, + "style": "form" + }, + "create#if_seq_no": { + "in": "query", + "name": "if_seq_no", + "description": "Only perform the operation if the document has this sequence number.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:SequenceNumber" + }, + "style": "form" + }, "create#include_source_on_error": { "in": "query", "name": "include_source_on_error", @@ -61282,6 +61332,16 @@ }, "style": "form" }, + "create#op_type": { + "in": "query", + "name": "op_type", + "description": "Set to `create` to only index the document if it does not already exist (put if absent).\nIf a document with the specified `_id` already exists, the indexing operation will fail.\nThe behavior is the same as using the `/_create` endpoint.\nIf a document ID is specified, this paramater defaults to `index`.\nOtherwise, it defaults to `create`.\nIf the request targets a data stream, an `op_type` of `create` is required.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:OpType" + }, + "style": "form" + }, "create#pipeline": { "in": "query", "name": "pipeline", @@ -61302,6 +61362,26 @@ }, "style": "form" }, + "create#require_alias": { + "in": "query", + "name": "require_alias", + "description": "If `true`, the destination must be an index alias.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + "create#require_data_stream": { + "in": "query", + "name": "require_data_stream", + "description": "If `true`, the request's actions must target a data stream (existing or to be created).", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, "create#routing": { "in": "query", "name": "routing", diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index acebadebd8..0c7d476bb6 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -16885,6 +16885,34 @@ } ], "query": [ + { + "description": "Only perform the operation if the document has this primary term.", + "extDocId": "optimistic-concurrency", + "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html", + "name": "if_primary_term", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "description": "Only perform the operation if the document has this sequence number.", + "extDocId": "optimistic-concurrency", + "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html", + "name": "if_seq_no", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SequenceNumber", + "namespace": "_types" + } + } + }, { "description": "True or false if to include the document source in the error message in case of parsing errors.", "name": "include_source_on_error", @@ -16898,6 +16926,18 @@ } } }, + { + "description": "Set to `create` to only index the document if it does not already exist (put if absent).\nIf a document with the specified `_id` already exists, the indexing operation will fail.\nThe behavior is the same as using the `/_create` endpoint.\nIf a document ID is specified, this paramater defaults to `index`.\nOtherwise, it defaults to `create`.\nIf the request targets a data stream, an `op_type` of `create` is required.", + "name": "op_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "OpType", + "namespace": "_types" + } + } + }, { "description": "The ID of the pipeline to use to preprocess incoming documents.\nIf the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.\nIf a final pipeline is configured, it will always run regardless of the value of this parameter.", "name": "pipeline", @@ -16923,6 +16963,32 @@ } } }, + { + "description": "If `true`, the destination must be an index alias.", + "name": "require_alias", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "If `true`, the request's actions must target a data stream (existing or to be created).", + "name": "require_data_stream", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "description": "A custom value that is used to route operations to a specific shard.", "name": "routing", @@ -16986,7 +17052,7 @@ } } ], - "specLocation": "_global/create/CreateRequest.ts#L32-L189" + "specLocation": "_global/create/CreateRequest.ts#L35-L221" }, { "body": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 005f525ea9..395aca4382 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -24318,6 +24318,34 @@ } ], "query": [ + { + "description": "Only perform the operation if the document has this primary term.", + "extDocId": "optimistic-concurrency", + "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html", + "name": "if_primary_term", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "description": "Only perform the operation if the document has this sequence number.", + "extDocId": "optimistic-concurrency", + "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html", + "name": "if_seq_no", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SequenceNumber", + "namespace": "_types" + } + } + }, { "description": "True or false if to include the document source in the error message in case of parsing errors.", "name": "include_source_on_error", @@ -24331,6 +24359,18 @@ } } }, + { + "description": "Set to `create` to only index the document if it does not already exist (put if absent).\nIf a document with the specified `_id` already exists, the indexing operation will fail.\nThe behavior is the same as using the `/_create` endpoint.\nIf a document ID is specified, this paramater defaults to `index`.\nOtherwise, it defaults to `create`.\nIf the request targets a data stream, an `op_type` of `create` is required.", + "name": "op_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "OpType", + "namespace": "_types" + } + } + }, { "description": "The ID of the pipeline to use to preprocess incoming documents.\nIf the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.\nIf a final pipeline is configured, it will always run regardless of the value of this parameter.", "name": "pipeline", @@ -24356,6 +24396,32 @@ } } }, + { + "description": "If `true`, the destination must be an index alias.", + "name": "require_alias", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "If `true`, the request's actions must target a data stream (existing or to be created).", + "name": "require_data_stream", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "description": "A custom value that is used to route operations to a specific shard.", "name": "routing", @@ -24419,7 +24485,7 @@ } } ], - "specLocation": "_global/create/CreateRequest.ts#L32-L189" + "specLocation": "_global/create/CreateRequest.ts#L35-L221" }, { "kind": "response", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index f2ed749089..55585a2738 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -206,6 +206,16 @@ ], "response": [] }, + "create": { + "request": [ + "Request: query parameter 'if_primary_term' does not exist in the json spec", + "Request: query parameter 'if_seq_no' does not exist in the json spec", + "Request: query parameter 'op_type' does not exist in the json spec", + "Request: query parameter 'require_alias' does not exist in the json spec", + "Request: query parameter 'require_data_stream' does not exist in the json spec" + ], + "response": [] + }, "eql.search": { "request": [ "Request: query parameter 'allow_no_indices' does not exist in the json spec", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 32b39ffc9f..e80db90b5e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -159,9 +159,14 @@ export interface CountResponse { export interface CreateRequest extends RequestBase { id: Id index: IndexName + if_primary_term?: long + if_seq_no?: SequenceNumber include_source_on_error?: boolean + op_type?: OpType pipeline?: string refresh?: Refresh + require_alias?: boolean + require_data_stream?: boolean routing?: Routing timeout?: Duration version?: VersionNumber diff --git a/specification/_global/create/CreateRequest.ts b/specification/_global/create/CreateRequest.ts index c7745b1ce5..35dcdcb72d 100644 --- a/specification/_global/create/CreateRequest.ts +++ b/specification/_global/create/CreateRequest.ts @@ -21,12 +21,15 @@ import { RequestBase } from '@_types/Base' import { Id, IndexName, + OpType, Refresh, Routing, + SequenceNumber, VersionNumber, VersionType, WaitForActiveShards } from '@_types/common' +import { long } from '@_types/Numeric' import { Duration } from '@_types/Time' /** @@ -131,11 +134,30 @@ export interface Request extends RequestBase { index: IndexName } query_parameters: { + /** + * Only perform the operation if the document has this primary term. + * @ext_doc_id optimistic-concurrency + */ + if_primary_term?: long + /** + * Only perform the operation if the document has this sequence number. + * @ext_doc_id optimistic-concurrency + */ + if_seq_no?: SequenceNumber /** * True or false if to include the document source in the error message in case of parsing errors. * @server_default true */ include_source_on_error?: boolean + /** + * Set to `create` to only index the document if it does not already exist (put if absent). + * If a document with the specified `_id` already exists, the indexing operation will fail. + * The behavior is the same as using the `/_create` endpoint. + * If a document ID is specified, this paramater defaults to `index`. + * Otherwise, it defaults to `create`. + * If the request targets a data stream, an `op_type` of `create` is required. + */ + op_type?: OpType /** * The ID of the pipeline 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. @@ -149,6 +171,16 @@ export interface Request extends RequestBase { * @server_default false */ refresh?: Refresh + /** + * If `true`, the destination must be an index alias. + * @server_default false + */ + require_alias?: boolean + /** + * If `true`, the request's actions must target a data stream (existing or to be created). + * @server_default false + */ + require_data_stream?: boolean /** * A custom value that is used to route operations to a specific shard. */