diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index ba8611effc..8d10ce9bfa 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -15824,6 +15824,176 @@ "x-product-feature": "elasticsearch" } }, + "/_data_stream/{name}/_mappings": { + "get": { + "tags": [ + "data stream" + ], + "summary": "Get data stream mappings", + "description": "Get mapping information for one or more data streams.\n\n## Required authorization\n\n* Index privileges: `view_index_metadata`\n", + "operationId": "indices-get-data-stream-mappings", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`).", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Indices" + }, + "style": "simple" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data_streams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/indices.get_data_stream_mappings.DataStreamMappings" + } + } + }, + "required": [ + "data_streams" + ] + }, + "examples": { + "IndicesGetDataStreamMappingsResponseExample1": { + "summary": "Get data stream settings on a data stream", + "description": "This is a response to `GET /_data_stream/my-data-stream/_settings` where my-data-stream that has two settings set. The `effective_settings` field shows additional settings that are pulled from its template.\n", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n \"effective_mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field2\": {\n \"type\": \"text\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n }\n ]\n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 9.1.0", + "x-product-feature": "elasticsearch" + }, + "put": { + "tags": [ + "data stream" + ], + "summary": "Update data stream mappings", + "description": "This API can be used to override mappings on specific data streams. These overrides will take precedence over what\nis specified in the template that the data stream matches. The mapping change is only applied to new write indices\nthat are created during rollover after this API is called. No indices are changed by this API.\n\n## Required authorization\n\n* Index privileges: `manage`\n", + "operationId": "indices-put-data-stream-mappings", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "A comma-separated list of data streams or data stream patterns.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Indices" + }, + "style": "simple" + }, + { + "in": "query", + "name": "dry_run", + "description": "If `true`, the request does not actually change the mappings on any data streams. Instead, it\nsimulates changing the settings and reports back to the user what would have happened had these settings\nactually been applied.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The period to wait for a response. If no response is received before the\n timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, + "examples": { + "IndicesPutDataStreamMappingsRequestExample1": { + "summary": "Change a data stream setting", + "description": "This is a request to add or modify two fields in a mapping on a data stream.\n", + "value": "{\n \"properties\":{\n \"field1\":{\n \"type\":\"ip\"\n },\n \"field3\":{\n \"type\":\"text\"\n }\n }\n}" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data_streams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/indices.put_data_stream_mappings.UpdatedDataStreamMappings" + } + } + }, + "required": [ + "data_streams" + ] + }, + "examples": { + "IndicesPutDataStreamMappingsResponseExample1": { + "summary": "Change data stream settings on a data stream", + "description": "This shows a response to `PUT /_data_stream/my-data-stream/_settings` when two settings are successfully updated on the data stream. In this case, `index.number_of_shards` is only applied to the data stream -- it will be applied to the write index on rollover. The setting `index.lifecycle.name` is applied to the data stream and all backing indices.\n", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"applied_to_data_stream\": true,\n \"mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n \"effective_mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n }\n ]\n}" + }, + "IndicesPutDataStreamMappingsResponseExample2": { + "summary": "Attempt to change a data stream setting that is not allowed", + "description": "This shows a response to `PUT /_data_stream/my-data-stream/_settings` when a user attempts to set a setting that is not allowed on a data stream. As a result, no change was applied to the data stream.\n", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"applied_to_data_stream\": false,\n \"error\": \"Failed to parse mapping: The mapper type [txt] declared on field [field1] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation.\",\n \"mappings\": {\n \"_doc\": {}\n },\n \"effective_mappings\": {\n \"_doc\": {}\n }\n }\n ]\n}" + } + } + } + } + } + }, + "x-state": "Generally available", + "x-product-feature": "elasticsearch" + } + }, "/_data_stream/{name}/_settings": { "get": { "tags": [ @@ -80006,6 +80176,9 @@ "settings": { "$ref": "#/components/schemas/indices._types.IndexSettings" }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, "status": { "$ref": "#/components/schemas/_types.HealthStatus" }, @@ -80116,6 +80289,26 @@ "name" ] }, + "indices.get_data_stream_mappings.DataStreamMappings": { + "type": "object", + "properties": { + "name": { + "description": "The name of the data stream.", + "type": "string" + }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, + "effective_mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + } + }, + "required": [ + "name", + "mappings", + "effective_mappings" + ] + }, "indices.get_data_stream_options.DataStreamWithOptions": { "type": "object", "properties": { @@ -80473,6 +80666,34 @@ "index" ] }, + "indices.put_data_stream_mappings.UpdatedDataStreamMappings": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/_types.IndexName" + }, + "applied_to_data_stream": { + "description": "If the mappings were successfully applied to the data stream (or would have been, if running in `dry_run`\nmode), it is `true`. If an error occurred, it is `false`.", + "type": "boolean" + }, + "error": { + "description": "A message explaining why the mappings could not be applied to the data stream.", + "type": "string" + }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, + "effective_mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + } + }, + "required": [ + "name", + "applied_to_data_stream", + "mappings", + "effective_mappings" + ] + }, "indices.put_data_stream_settings.UpdatedDataStreamSettings": { "type": "object", "properties": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index de0ec42750..f2e39c36d6 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -8319,6 +8319,176 @@ "x-product-feature": "elasticsearch" } }, + "/_data_stream/{name}/_mappings": { + "get": { + "tags": [ + "data stream" + ], + "summary": "Get data stream mappings", + "description": "Get mapping information for one or more data streams.\n\n## Required authorization\n\n* Index privileges: `view_index_metadata`\n", + "operationId": "indices-get-data-stream-mappings", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`).", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Indices" + }, + "style": "simple" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data_streams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/indices.get_data_stream_mappings.DataStreamMappings" + } + } + }, + "required": [ + "data_streams" + ] + }, + "examples": { + "IndicesGetDataStreamMappingsResponseExample1": { + "summary": "Get data stream settings on a data stream", + "description": "This is a response to `GET /_data_stream/my-data-stream/_settings` where my-data-stream that has two settings set. The `effective_settings` field shows additional settings that are pulled from its template.\n", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n \"effective_mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field2\": {\n \"type\": \"text\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n }\n ]\n}" + } + } + } + } + } + }, + "x-state": "Generally available", + "x-product-feature": "elasticsearch" + }, + "put": { + "tags": [ + "data stream" + ], + "summary": "Update data stream mappings", + "description": "This API can be used to override mappings on specific data streams. These overrides will take precedence over what\nis specified in the template that the data stream matches. The mapping change is only applied to new write indices\nthat are created during rollover after this API is called. No indices are changed by this API.\n\n## Required authorization\n\n* Index privileges: `manage`\n", + "operationId": "indices-put-data-stream-mappings", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "A comma-separated list of data streams or data stream patterns.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Indices" + }, + "style": "simple" + }, + { + "in": "query", + "name": "dry_run", + "description": "If `true`, the request does not actually change the mappings on any data streams. Instead, it\nsimulates changing the settings and reports back to the user what would have happened had these settings\nactually been applied.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The period to wait for a response. If no response is received before the\n timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, + "examples": { + "IndicesPutDataStreamMappingsRequestExample1": { + "summary": "Change a data stream setting", + "description": "This is a request to add or modify two fields in a mapping on a data stream.\n", + "value": "{\n \"properties\":{\n \"field1\":{\n \"type\":\"ip\"\n },\n \"field3\":{\n \"type\":\"text\"\n }\n }\n}" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data_streams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/indices.put_data_stream_mappings.UpdatedDataStreamMappings" + } + } + }, + "required": [ + "data_streams" + ] + }, + "examples": { + "IndicesPutDataStreamMappingsResponseExample1": { + "summary": "Change data stream settings on a data stream", + "description": "This shows a response to `PUT /_data_stream/my-data-stream/_settings` when two settings are successfully updated on the data stream. In this case, `index.number_of_shards` is only applied to the data stream -- it will be applied to the write index on rollover. The setting `index.lifecycle.name` is applied to the data stream and all backing indices.\n", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"applied_to_data_stream\": true,\n \"mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n \"effective_mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n }\n ]\n}" + }, + "IndicesPutDataStreamMappingsResponseExample2": { + "summary": "Attempt to change a data stream setting that is not allowed", + "description": "This shows a response to `PUT /_data_stream/my-data-stream/_settings` when a user attempts to set a setting that is not allowed on a data stream. As a result, no change was applied to the data stream.\n", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"applied_to_data_stream\": false,\n \"error\": \"Failed to parse mapping: The mapper type [txt] declared on field [field1] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation.\",\n \"mappings\": {\n \"_doc\": {}\n },\n \"effective_mappings\": {\n \"_doc\": {}\n }\n }\n ]\n}" + } + } + } + } + } + }, + "x-state": "Generally available", + "x-product-feature": "elasticsearch" + } + }, "/_data_stream/{name}/_options": { "get": { "tags": [ @@ -51708,6 +51878,9 @@ "settings": { "$ref": "#/components/schemas/indices._types.IndexSettings" }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, "status": { "$ref": "#/components/schemas/_types.HealthStatus" }, @@ -51818,6 +51991,26 @@ "name" ] }, + "indices.get_data_stream_mappings.DataStreamMappings": { + "type": "object", + "properties": { + "name": { + "description": "The name of the data stream.", + "type": "string" + }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, + "effective_mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + } + }, + "required": [ + "name", + "mappings", + "effective_mappings" + ] + }, "indices.get_data_stream_options.DataStreamWithOptions": { "type": "object", "properties": { @@ -52036,6 +52229,34 @@ "index" ] }, + "indices.put_data_stream_mappings.UpdatedDataStreamMappings": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/_types.IndexName" + }, + "applied_to_data_stream": { + "description": "If the mappings were successfully applied to the data stream (or would have been, if running in `dry_run`\nmode), it is `true`. If an error occurred, it is `false`.", + "type": "boolean" + }, + "error": { + "description": "A message explaining why the mappings could not be applied to the data stream.", + "type": "string" + }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + }, + "effective_mappings": { + "$ref": "#/components/schemas/_types.mapping.TypeMapping" + } + }, + "required": [ + "name", + "applied_to_data_stream", + "mappings", + "effective_mappings" + ] + }, "indices.put_data_stream_settings.UpdatedDataStreamSettings": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 39eb756f7f..9ba0be6ff8 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -7932,18 +7932,35 @@ }, { "availability": { + "serverless": { + "stability": "stable", + "visibility": "public" + }, "stack": { - "featureFlag": "logs_stream", + "since": "9.1.0", "stability": "stable", - "visibility": "feature_flag" + "visibility": "public" } }, - "description": "Gets a data stream's mappings", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html", + "description": "Get data stream mappings.\n\nGet mapping information for one or more data streams.", + "docId": "indices-get-data-stream-mappings", + "docTag": "data stream", + "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-mappings", "name": "indices.get_data_stream_mappings", - "request": null, + "privileges": { + "index": [ + "view_index_metadata" + ] + }, + "request": { + "name": "Request", + "namespace": "indices.get_data_stream_mappings" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "indices.get_data_stream_mappings" + }, "responseMediaType": [ "application/json" ], @@ -8609,18 +8626,34 @@ }, { "availability": { + "serverless": { + "stability": "stable", + "visibility": "public" + }, "stack": { - "featureFlag": "logs_stream", "stability": "stable", - "visibility": "feature_flag" + "visibility": "public" } }, - "description": "Updates a data stream's mappings", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html", + "description": "Update data stream mappings.\n\nThis API can be used to override mappings on specific data streams. These overrides will take precedence over what\nis specified in the template that the data stream matches. The mapping change is only applied to new write indices\nthat are created during rollover after this API is called. No indices are changed by this API.", + "docId": "indices-put-data-stream-mappings", + "docTag": "data stream", + "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-mappings", "name": "indices.put_data_stream_mappings", - "request": null, + "privileges": { + "index": [ + "manage" + ] + }, + "request": { + "name": "Request", + "namespace": "indices.put_data_stream_mappings" + }, "requestBodyRequired": true, - "response": null, + "response": { + "name": "Response", + "namespace": "indices.put_data_stream_mappings" + }, "responseMediaType": [ "application/json" ], @@ -142455,6 +142488,18 @@ } } }, + { + "description": "The mappings specific to this data stream that will take precedence over the mappings in the matching index\ntemplate.", + "name": "mappings", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + }, { "description": "Health status of the data stream.\nThis health status is based on the state of the primary and replica shards of the stream’s backing indices.", "name": "status", @@ -142522,7 +142567,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L54-L145" + "specLocation": "indices/_types/DataStream.ts#L55-L151" }, { "kind": "interface", @@ -142700,7 +142745,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L154-L179" + "specLocation": "indices/_types/DataStream.ts#L160-L185" }, { "kind": "interface", @@ -143001,7 +143046,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L147-L152" + "specLocation": "indices/_types/DataStream.ts#L153-L158" }, { "kind": "interface", @@ -143033,7 +143078,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L181-L184" + "specLocation": "indices/_types/DataStream.ts#L187-L190" }, { "kind": "interface", @@ -143135,7 +143180,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L48-L52" + "specLocation": "indices/_types/DataStream.ts#L49-L53" }, { "kind": "interface", @@ -143304,7 +143349,7 @@ "name": "IndexMode", "namespace": "indices._types" }, - "specLocation": "indices/_types/DataStream.ts#L41-L46" + "specLocation": "indices/_types/DataStream.ts#L42-L47" }, { "kind": "interface", @@ -145431,7 +145476,7 @@ "name": "ManagedBy", "namespace": "indices._types" }, - "specLocation": "indices/_types/DataStream.ts#L33-L38" + "specLocation": "indices/_types/DataStream.ts#L34-L39" }, { "kind": "interface", @@ -153460,6 +153505,163 @@ }, "specLocation": "indices/get_data_stream/IndicesGetDataStreamResponse.ts#L22-L24" }, + { + "kind": "interface", + "name": { + "name": "DataStreamMappings", + "namespace": "indices.get_data_stream_mappings" + }, + "properties": [ + { + "description": "The name of the data stream.", + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The settings specific to this data stream", + "name": "mappings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + }, + { + "description": "The settings specific to this data stream merged with the settings from its template. These `effective_settings`\nare the settings that will be used when a new index is created for this data stream.", + "name": "effective_mappings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + } + ], + "specLocation": "indices/get_data_stream_mappings/IndicesGetDataStreamMappingsResponse.ts#L29-L39" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get data stream mappings.\n\nGet mapping information for one or more data streams.", + "examples": { + "IndicesGetDataStreamMappingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_data_stream_mappings(\n name=\"my-data-stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getDataStreamSettings({\n name: \"my-data-stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_data_stream_mappings(\n name: \"my-data-stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getDataStreamSettings([\n \"name\" => \"my-data-stream\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings\"", + "language": "curl" + } + ], + "method_request": "GET /_data_stream/my-data-stream/_mappings" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.get_data_stream_mappings" + }, + "path": [ + { + "description": "A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`).", + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Indices", + "namespace": "_types" + } + } + } + ], + "query": [ + { + "description": "The period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/get_data_stream_mappings/IndicesGetDataStreamMappingsRequest.ts#L24-L57" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "data_streams", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "DataStreamMappings", + "namespace": "indices.get_data_stream_mappings" + } + } + } + } + ] + }, + "examples": { + "IndicesGetDataStreamMappingsResponseExample1": { + "description": "This is a response to `GET /_data_stream/my-data-stream/_settings` where my-data-stream that has two settings set. The `effective_settings` field shows additional settings that are pulled from its template.\n", + "summary": "Get data stream settings on a data stream", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n \"effective_mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field2\": {\n \"type\": \"text\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n }\n ]\n}" + } + }, + "name": { + "name": "Response", + "namespace": "indices.get_data_stream_mappings" + }, + "specLocation": "indices/get_data_stream_mappings/IndicesGetDataStreamMappingsResponse.ts#L22-L27" + }, { "kind": "interface", "name": { @@ -156058,6 +156260,229 @@ }, "specLocation": "indices/put_data_lifecycle/IndicesPutDataLifecycleResponse.ts#L22-L25" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "value", + "codegenName": "mappings", + "value": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + }, + "description": "Update data stream mappings.\n\nThis API can be used to override mappings on specific data streams. These overrides will take precedence over what\nis specified in the template that the data stream matches. The mapping change is only applied to new write indices\nthat are created during rollover after this API is called. No indices are changed by this API.", + "examples": { + "IndicesPutDataStreamMappingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.put_data_stream_mappings(\n name=\"my-data-stream\",\n mappings={\n \"properties\":{\n \"field1\":{\n \"type\":\"ip\"\n },\n \"field3\":{\n \"type\":\"text\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putDataStreamSettings({\n name: \"my-data-stream\",\n mappings: {\n \"properties\":{\n \"field1\":{\n \"type\":\"ip\"\n },\n \"field3\":{\n \"type\":\"text\"\n }\n }\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_data_stream_mappings(\n name: \"my-data-stream\",\n body: {\n \"properties\":{\n \"field1\":{\n \"type\":\"ip\"\n },\n \"field3\":{\n \"type\":\"text\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putDataStreamSettings([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"properties\" => [\n \"field1\" => [\n \"type\" => \"ip\"\n ],\n \"field3\" => [\n \"type\" => \"text\"\n ]\n ]\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index.lifecycle.name\":\"new-test-policy\",\"index.number_of_shards\":11}' \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings\"", + "language": "curl" + } + ], + "description": "This is a request to add or modify two fields in a mapping on a data stream.\n", + "method_request": "PUT /_data_stream/my-data-stream/_mappings", + "summary": "Change a data stream setting", + "value": "{\n \"properties\":{\n \"field1\":{\n \"type\":\"ip\"\n },\n \"field3\":{\n \"type\":\"text\"\n }\n }\n}" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.put_data_stream_mappings" + }, + "path": [ + { + "description": "A comma-separated list of data streams or data stream patterns.", + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Indices", + "namespace": "_types" + } + } + } + ], + "query": [ + { + "description": "If `true`, the request does not actually change the mappings on any data streams. Instead, it\nsimulates changing the settings and reports back to the user what would have happened had these settings\nactually been applied.", + "name": "dry_run", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The period to wait for a response. If no response is received before the\n timeout expires, the request fails and returns an error.", + "name": "timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/put_data_stream_mappings/IndicesPutDataStreamMappingsRequest.ts#L25-L76" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "data_streams", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "UpdatedDataStreamMappings", + "namespace": "indices.put_data_stream_mappings" + } + } + } + } + ] + }, + "examples": { + "IndicesPutDataStreamMappingsResponseExample1": { + "description": "This shows a response to `PUT /_data_stream/my-data-stream/_settings` when two settings are successfully updated on the data stream. In this case, `index.number_of_shards` is only applied to the data stream -- it will be applied to the write index on rollover. The setting `index.lifecycle.name` is applied to the data stream and all backing indices.\n", + "summary": "Change data stream settings on a data stream", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"applied_to_data_stream\": true,\n \"mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n \"effective_mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n }\n ]\n}" + }, + "IndicesPutDataStreamMappingsResponseExample2": { + "description": "This shows a response to `PUT /_data_stream/my-data-stream/_settings` when a user attempts to set a setting that is not allowed on a data stream. As a result, no change was applied to the data stream.\n", + "summary": "Attempt to change a data stream setting that is not allowed", + "value": "{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \"applied_to_data_stream\": false,\n \"error\": \"Failed to parse mapping: The mapper type [txt] declared on field [field1] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation.\",\n \"mappings\": {\n \"_doc\": {}\n },\n \"effective_mappings\": {\n \"_doc\": {}\n }\n }\n ]\n}" + } + }, + "name": { + "name": "Response", + "namespace": "indices.put_data_stream_mappings" + }, + "specLocation": "indices/put_data_stream_mappings/IndicesPutDataStreamMappingsResponse.ts#L23-L28" + }, + { + "kind": "interface", + "name": { + "name": "UpdatedDataStreamMappings", + "namespace": "indices.put_data_stream_mappings" + }, + "properties": [ + { + "description": "The data stream name.", + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "description": "If the mappings were successfully applied to the data stream (or would have been, if running in `dry_run`\nmode), it is `true`. If an error occurred, it is `false`.", + "name": "applied_to_data_stream", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "A message explaining why the mappings could not be applied to the data stream.", + "name": "error", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The mappings that are specfic to this data stream that will override any mappings from the matching index template.", + "name": "mappings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + }, + { + "description": "The mappings that are effective on this data stream, taking into account the mappings from the matching index\ntemplate and the mappings specific to this data stream.", + "name": "effective_mappings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + } + ], + "specLocation": "indices/put_data_stream_mappings/IndicesPutDataStreamMappingsResponse.ts#L30-L51" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 6886c9aae0..f14746ad1d 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11513,6 +11513,7 @@ export interface IndicesDataStream { replicated?: boolean rollover_on_write: boolean settings: IndicesIndexSettings + mappings?: MappingTypeMapping status: HealthStatus system?: boolean template: Name @@ -12539,6 +12540,21 @@ export interface IndicesGetDataStreamResponse { data_streams: IndicesDataStream[] } +export interface IndicesGetDataStreamMappingsDataStreamMappings { + name: string + mappings: MappingTypeMapping + effective_mappings: MappingTypeMapping +} + +export interface IndicesGetDataStreamMappingsRequest extends RequestBase { + name: Indices + master_timeout?: Duration +} + +export interface IndicesGetDataStreamMappingsResponse { + data_streams: IndicesGetDataStreamMappingsDataStreamMappings[] +} + export interface IndicesGetDataStreamOptionsDataStreamWithOptions { name: DataStreamName options?: IndicesDataStreamOptions @@ -12763,6 +12779,26 @@ export interface IndicesPutDataLifecycleRequest extends RequestBase { export type IndicesPutDataLifecycleResponse = AcknowledgedResponseBase +export interface IndicesPutDataStreamMappingsRequest extends RequestBase { + name: Indices + dry_run?: boolean + master_timeout?: Duration + timeout?: Duration + body?: MappingTypeMapping +} + +export interface IndicesPutDataStreamMappingsResponse { + data_streams: IndicesPutDataStreamMappingsUpdatedDataStreamMappings[] +} + +export interface IndicesPutDataStreamMappingsUpdatedDataStreamMappings { + name: IndexName + applied_to_data_stream: boolean + error?: string + mappings: MappingTypeMapping + effective_mappings: MappingTypeMapping +} + export interface IndicesPutDataStreamOptionsRequest extends RequestBase { name: DataStreamNames expand_wildcards?: ExpandWildcards diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 9cdcf32a82..416a6ff457 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -315,6 +315,7 @@ indices-exists,https://www.elastic.co/docs/api/doc/elasticsearch/operation/opera indices-flush,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-flush,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-flush.html indices-forcemerge,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-forcemerge.html indices-get-alias,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-alias,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-alias.html +indices-get-data-stream-mappings,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-mappings, indices-get-data-stream-settings,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-settings, indices-get-field-mapping,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-mapping,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-field-mapping.html indices-get-index,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-index.html @@ -323,6 +324,7 @@ indices-get-settings,https://www.elastic.co/docs/api/doc/elasticsearch/operation indices-get-template,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-index-template,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-template.html indices-get-template-v1,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-template,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-get-template-v1.html indices-open-close,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-open,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-open-close.html +indices-put-data-stream-mappings,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-mappings, indices-put-data-stream-settings,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-settings, indices-put-mapping,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-mapping,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-put-mapping.html indices-recovery,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-recovery,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-recovery.html diff --git a/specification/indices/_types/DataStream.ts b/specification/indices/_types/DataStream.ts index 76528276c8..1f1fb4f371 100644 --- a/specification/indices/_types/DataStream.ts +++ b/specification/indices/_types/DataStream.ts @@ -26,6 +26,7 @@ import { Name, Uuid } from '@_types/common' +import { TypeMapping } from '@_types/mapping/TypeMapping' import { integer } from '@_types/Numeric' import { DataStreamLifecycleWithRollover } from '@indices/_types/DataStreamLifecycle' import { IndexSettings } from '@indices/_types/IndexSettings' @@ -118,6 +119,11 @@ export class DataStream { * template. */ settings: IndexSettings + /** + * The mappings specific to this data stream that will take precedence over the mappings in the matching index + * template. + */ + mappings?: TypeMapping /** * Health status of the data stream. * This health status is based on the state of the primary and replica shards of the stream’s backing indices. diff --git a/specification/indices/get_data_stream_mappings/IndicesGetDataStreamMappingsRequest.ts b/specification/indices/get_data_stream_mappings/IndicesGetDataStreamMappingsRequest.ts new file mode 100644 index 0000000000..b7adbda6a7 --- /dev/null +++ b/specification/indices/get_data_stream_mappings/IndicesGetDataStreamMappingsRequest.ts @@ -0,0 +1,57 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Indices } from '@_types/common' +import { Duration } from '@_types/Time' + +/** + * Get data stream mappings. + * + * Get mapping information for one or more data streams. + * @rest_spec_name indices.get_data_stream_mappings + * @availability stack since=9.1.0 stability=stable visibility=public + * @availability serverless stability=stable visibility=public + * @index_privileges view_index_metadata + * @doc_id indices-get-data-stream-mappings + * @doc_tag data stream + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_data_stream/{name}/_mappings' + methods: ['GET'] + } + ] + path_parts: { + /** + * A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`). + */ + name: Indices + } + query_parameters: { + /** + * The period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an + * error. + * @server_default 30s + */ + master_timeout?: Duration + } +} diff --git a/specification/indices/get_data_stream_mappings/IndicesGetDataStreamMappingsResponse.ts b/specification/indices/get_data_stream_mappings/IndicesGetDataStreamMappingsResponse.ts new file mode 100644 index 0000000000..5d79c3bbe4 --- /dev/null +++ b/specification/indices/get_data_stream_mappings/IndicesGetDataStreamMappingsResponse.ts @@ -0,0 +1,39 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { TypeMapping } from '@_types/mapping/TypeMapping' + +export class Response { + /** @codegen_name data_stream_mappings */ + body: { + data_streams: Array + } +} + +export class DataStreamMappings { + /** The name of the data stream. */ + name: string + /** The settings specific to this data stream */ + mappings: TypeMapping + /** + * The settings specific to this data stream merged with the settings from its template. These `effective_settings` + * are the settings that will be used when a new index is created for this data stream. + */ + effective_mappings: TypeMapping +} diff --git a/specification/indices/get_data_stream_mappings/examples/200_response/IndicesGetDataStreamMappingsResponseExample1.yaml b/specification/indices/get_data_stream_mappings/examples/200_response/IndicesGetDataStreamMappingsResponseExample1.yaml new file mode 100644 index 0000000000..85d21fb0d7 --- /dev/null +++ b/specification/indices/get_data_stream_mappings/examples/200_response/IndicesGetDataStreamMappingsResponseExample1.yaml @@ -0,0 +1,37 @@ +summary: Get data stream settings on a data stream +description: > + This is a response to `GET /_data_stream/my-data-stream/_settings` where my-data-stream that has two settings set. The + `effective_settings` field shows additional settings that are pulled from its template. +# type: response +# response_code: 200 +value: |- + { + "data_streams": [ + { + "name": "my-data-stream", + "mappings": { + "properties": { + "field1": { + "type": "ip" + }, + "field3": { + "type": "text" + } + } + }, + "effective_mappings": { + "properties": { + "field1": { + "type": "ip" + }, + "field2": { + "type": "text" + }, + "field3": { + "type": "text" + } + } + } + } + ] + } diff --git a/specification/indices/get_data_stream_mappings/examples/request/IndicesGetDataStreamMappingsRequestExample1.yaml b/specification/indices/get_data_stream_mappings/examples/request/IndicesGetDataStreamMappingsRequestExample1.yaml new file mode 100644 index 0000000000..8b422783f3 --- /dev/null +++ b/specification/indices/get_data_stream_mappings/examples/request/IndicesGetDataStreamMappingsRequestExample1.yaml @@ -0,0 +1,24 @@ +method_request: GET /_data_stream/my-data-stream/_mappings +alternatives: + - language: Python + code: |- + resp = client.indices.get_data_stream_mappings( + name="my-data-stream", + ) + - language: JavaScript + code: |- + const response = await client.indices.getDataStreamSettings({ + name: "my-data-stream", + }); + - language: Ruby + code: |- + response = client.indices.get_data_stream_mappings( + name: "my-data-stream" + ) + - language: PHP + code: |- + $resp = $client->indices()->getDataStreamSettings([ + "name" => "my-data-stream", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings"' diff --git a/specification/indices/put_data_stream_mappings/IndicesPutDataStreamMappingsRequest.ts b/specification/indices/put_data_stream_mappings/IndicesPutDataStreamMappingsRequest.ts new file mode 100644 index 0000000000..bd54b6ef88 --- /dev/null +++ b/specification/indices/put_data_stream_mappings/IndicesPutDataStreamMappingsRequest.ts @@ -0,0 +1,76 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Indices } from '@_types/common' +import { TypeMapping } from '@_types/mapping/TypeMapping' +import { Duration } from '@_types/Time' + +/** + * Update data stream mappings. + * + * This API can be used to override mappings on specific data streams. These overrides will take precedence over what + * is specified in the template that the data stream matches. The mapping change is only applied to new write indices + * that are created during rollover after this API is called. No indices are changed by this API. + * @rest_spec_name indices.put_data_stream_mappings + * @availability stack stability=stable visibility=public + * @availability serverless stability=stable visibility=public + * @index_privileges manage + * @doc_id indices-put-data-stream-mappings + * @doc_tag data stream + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_data_stream/{name}/_mappings' + methods: ['PUT'] + } + ] + path_parts: { + /** + * A comma-separated list of data streams or data stream patterns. + */ + name: Indices + } + query_parameters: { + /** + * If `true`, the request does not actually change the mappings on any data streams. Instead, it + * simulates changing the settings and reports back to the user what would have happened had these settings + * actually been applied. + * @server_default false + */ + dry_run?: boolean + /** + * The period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an + * error. + * @server_default 30s + */ + master_timeout?: Duration + /** + * The period to wait for a response. If no response is received before the + * timeout expires, the request fails and returns an error. + * @server_default 30s + */ + timeout?: Duration + } + /** Mappings to be applied to the data stream. + * @codegen_name mappings */ + body: TypeMapping +} diff --git a/specification/indices/put_data_stream_mappings/IndicesPutDataStreamMappingsResponse.ts b/specification/indices/put_data_stream_mappings/IndicesPutDataStreamMappingsResponse.ts new file mode 100644 index 0000000000..cfd39b8f66 --- /dev/null +++ b/specification/indices/put_data_stream_mappings/IndicesPutDataStreamMappingsResponse.ts @@ -0,0 +1,51 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IndexName } from '@_types/common' +import { TypeMapping } from '@_types/mapping/TypeMapping' + +export class Response { + /** @codegen_name data_stream_mappings_results */ + body: { + data_streams: Array + } +} + +export class UpdatedDataStreamMappings { + /** The data stream name. */ + name: IndexName + /** + * If the mappings were successfully applied to the data stream (or would have been, if running in `dry_run` + * mode), it is `true`. If an error occurred, it is `false`. + */ + applied_to_data_stream: boolean + /** + * A message explaining why the mappings could not be applied to the data stream. + */ + error?: string + /** + * The mappings that are specfic to this data stream that will override any mappings from the matching index template. + */ + mappings: TypeMapping + /** + * The mappings that are effective on this data stream, taking into account the mappings from the matching index + * template and the mappings specific to this data stream. + */ + effective_mappings: TypeMapping +} diff --git a/specification/indices/put_data_stream_mappings/examples/200_response/IndicesPutDataStreamMappingsResponseExample1.yaml b/specification/indices/put_data_stream_mappings/examples/200_response/IndicesPutDataStreamMappingsResponseExample1.yaml new file mode 100644 index 0000000000..9ecff70872 --- /dev/null +++ b/specification/indices/put_data_stream_mappings/examples/200_response/IndicesPutDataStreamMappingsResponseExample1.yaml @@ -0,0 +1,36 @@ +summary: Change data stream settings on a data stream +description: > + This shows a response to `PUT /_data_stream/my-data-stream/_settings` when two settings are successfully updated on + the data stream. In this case, `index.number_of_shards` is only applied to the data stream -- it will be applied to + the write index on rollover. The setting `index.lifecycle.name` is applied to the data stream and all backing indices. +# type: response +# response_code: 200 +value: |- + { + "data_streams": [ + { + "name": "my-data-stream", + "applied_to_data_stream": true, + "mappings": { + "properties": { + "field1": { + "type": "ip" + }, + "field3": { + "type": "text" + } + } + }, + "effective_mappings": { + "properties": { + "field1": { + "type": "ip" + }, + "field3": { + "type": "text" + } + } + } + } + ] + } diff --git a/specification/indices/put_data_stream_mappings/examples/200_response/IndicesPutDataStreamMappingsResponseExample2.yaml b/specification/indices/put_data_stream_mappings/examples/200_response/IndicesPutDataStreamMappingsResponseExample2.yaml new file mode 100644 index 0000000000..75289b1a50 --- /dev/null +++ b/specification/indices/put_data_stream_mappings/examples/200_response/IndicesPutDataStreamMappingsResponseExample2.yaml @@ -0,0 +1,22 @@ +summary: Attempt to change a data stream setting that is not allowed +description: > + This shows a response to `PUT /_data_stream/my-data-stream/_settings` when a user attempts to set a setting that is + not allowed on a data stream. As a result, no change was applied to the data stream. +# type: response +# response_code: 200 +value: |- + { + "data_streams": [ + { + "name": "my-data-stream", + "applied_to_data_stream": false, + "error": "Failed to parse mapping: The mapper type [txt] declared on field [field1] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation.", + "mappings": { + "_doc": {} + }, + "effective_mappings": { + "_doc": {} + } + } + ] + } diff --git a/specification/indices/put_data_stream_mappings/examples/request/IndicesPutDataStreamMappingsRequestExample1.yaml b/specification/indices/put_data_stream_mappings/examples/request/IndicesPutDataStreamMappingsRequestExample1.yaml new file mode 100644 index 0000000000..14f240183a --- /dev/null +++ b/specification/indices/put_data_stream_mappings/examples/request/IndicesPutDataStreamMappingsRequestExample1.yaml @@ -0,0 +1,82 @@ +summary: Change a data stream setting +method_request: PUT /_data_stream/my-data-stream/_mappings +description: > + This is a request to add or modify two fields in a mapping on a data stream. +# type: request +value: |- + { + "properties":{ + "field1":{ + "type":"ip" + }, + "field3":{ + "type":"text" + } + } + } +alternatives: + - language: Python + code: |- + resp = client.indices.put_data_stream_mappings( + name="my-data-stream", + mappings={ + "properties":{ + "field1":{ + "type":"ip" + }, + "field3":{ + "type":"text" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putDataStreamSettings({ + name: "my-data-stream", + mappings: { + "properties":{ + "field1":{ + "type":"ip" + }, + "field3":{ + "type":"text" + } + } + }, + }); + - language: Ruby + code: |- + response = client.indices.put_data_stream_mappings( + name: "my-data-stream", + body: { + "properties":{ + "field1":{ + "type":"ip" + }, + "field3":{ + "type":"text" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putDataStreamSettings([ + "name" => "my-data-stream", + "body" => [ + "properties" => [ + "field1" => [ + "type" => "ip" + ], + "field3" => [ + "type" => "text" + ] + ] + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index.lifecycle.name":"new-test-policy","index.number_of_shards":11}'' + "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings"'