From da5b88f4a67bf0057334356a47d944dfaabd568c Mon Sep 17 00:00:00 2001 From: kosabogi <105062005+kosabogi@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:55:12 +0200 Subject: [PATCH] Link to examples in the update mapping API guide (#4562) Co-authored-by: Quentin Pradet (cherry picked from commit 6a9757a86f79662a2ae3fa64e661e890d0ad9211) --- output/openapi/elasticsearch-openapi.json | 5 ++- .../elasticsearch-serverless-openapi.json | 4 +- output/schema/schema.json | 9 ++--- .../put_mapping/IndicesPutMappingRequest.ts | 38 ++++++------------- 4 files changed, 20 insertions(+), 36 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 293e6a8eb2..37edecbf3e 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -21707,7 +21707,7 @@ "indices" ], "summary": "Update field mappings", - "description": "Add new fields to an existing data stream or index.\nYou can also use this API to change the search settings of existing fields and add new properties to existing object fields.\nFor data streams, these changes are applied to all backing indices by default.\n\n**Add multi-fields to an existing field**\n\nMulti-fields let you index the same field in different ways.\nYou can use this API to update the fields mapping parameter and enable multi-fields for an existing field.\nWARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.\nYou can populate the new multi-field with the update by query API.\n\n**Change supported mapping parameters for an existing field**\n\nThe documentation for each mapping parameter indicates whether you can update it for an existing field using this API.\nFor example, you can use the update mapping API to update the `ignore_above` parameter.\n\n**Change the mapping of an existing field**\n\nExcept for supported mapping parameters, you can't change the mapping or field type of an existing field.\nChanging an existing field could invalidate data that's already indexed.\n\nIf you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.\nIf you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.\n\n**Rename a field**\n\nRenaming a field would invalidate data already indexed under the old field name.\nInstead, add an alias field to create an alternate field name.\n\n## Required authorization\n\n* Index privileges: `manage`\n", + "description": "Add new fields to an existing data stream or index.\nYou can use the update mapping API to:\n\n- Add a new field to an existing index\n- Update mappings for multiple indices in a single request\n- Add new properties to an object field\n- Enable multi-fields for an existing field\n- Update supported mapping parameters\n- Change a field's mapping using reindexing\n- Rename a field using a field alias\n\nLearn how to use the update mapping API with practical examples in the [Update mapping API examples](https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples) guide.\n\n## Required authorization\n\n* Index privileges: `manage`\n", "externalDocs": { "url": "https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-parameters" }, @@ -21775,7 +21775,7 @@ "indices" ], "summary": "Update field mappings", - "description": "Add new fields to an existing data stream or index.\nYou can also use this API to change the search settings of existing fields and add new properties to existing object fields.\nFor data streams, these changes are applied to all backing indices by default.\n\n**Add multi-fields to an existing field**\n\nMulti-fields let you index the same field in different ways.\nYou can use this API to update the fields mapping parameter and enable multi-fields for an existing field.\nWARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.\nYou can populate the new multi-field with the update by query API.\n\n**Change supported mapping parameters for an existing field**\n\nThe documentation for each mapping parameter indicates whether you can update it for an existing field using this API.\nFor example, you can use the update mapping API to update the `ignore_above` parameter.\n\n**Change the mapping of an existing field**\n\nExcept for supported mapping parameters, you can't change the mapping or field type of an existing field.\nChanging an existing field could invalidate data that's already indexed.\n\nIf you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.\nIf you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.\n\n**Rename a field**\n\nRenaming a field would invalidate data already indexed under the old field name.\nInstead, add an alias field to create an alternate field name.\n\n## Required authorization\n\n* Index privileges: `manage`\n", + "description": "Add new fields to an existing data stream or index.\nYou can use the update mapping API to:\n\n- Add a new field to an existing index\n- Update mappings for multiple indices in a single request\n- Add new properties to an object field\n- Enable multi-fields for an existing field\n- Update supported mapping parameters\n- Change a field's mapping using reindexing\n- Rename a field using a field alias\n\nLearn how to use the update mapping API with practical examples in the [Update mapping API examples](https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples) guide.\n\n## Required authorization\n\n* Index privileges: `manage`\n", "externalDocs": { "url": "https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-parameters" }, @@ -87895,6 +87895,7 @@ ] }, "_types.NodeRoles": { + "description": "* @doc_id node-roles", "type": "array", "items": { "$ref": "#/components/schemas/_types.NodeRole" diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index a7b7b97854..faf20cc529 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -11552,7 +11552,7 @@ "indices" ], "summary": "Update field mappings", - "description": "Add new fields to an existing data stream or index.\nYou can also use this API to change the search settings of existing fields and add new properties to existing object fields.\nFor data streams, these changes are applied to all backing indices by default.\n\n**Add multi-fields to an existing field**\n\nMulti-fields let you index the same field in different ways.\nYou can use this API to update the fields mapping parameter and enable multi-fields for an existing field.\nWARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.\nYou can populate the new multi-field with the update by query API.\n\n**Change supported mapping parameters for an existing field**\n\nThe documentation for each mapping parameter indicates whether you can update it for an existing field using this API.\nFor example, you can use the update mapping API to update the `ignore_above` parameter.\n\n**Change the mapping of an existing field**\n\nExcept for supported mapping parameters, you can't change the mapping or field type of an existing field.\nChanging an existing field could invalidate data that's already indexed.\n\nIf you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.\nIf you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.\n\n**Rename a field**\n\nRenaming a field would invalidate data already indexed under the old field name.\nInstead, add an alias field to create an alternate field name.\n\n## Required authorization\n\n* Index privileges: `manage`\n", + "description": "Add new fields to an existing data stream or index.\nYou can use the update mapping API to:\n\n- Add a new field to an existing index\n- Update mappings for multiple indices in a single request\n- Add new properties to an object field\n- Enable multi-fields for an existing field\n- Update supported mapping parameters\n- Change a field's mapping using reindexing\n- Rename a field using a field alias\n\nLearn how to use the update mapping API with practical examples in the [Update mapping API examples](https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples) guide.\n\n## Required authorization\n\n* Index privileges: `manage`\n", "externalDocs": { "url": "https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-parameters" }, @@ -11620,7 +11620,7 @@ "indices" ], "summary": "Update field mappings", - "description": "Add new fields to an existing data stream or index.\nYou can also use this API to change the search settings of existing fields and add new properties to existing object fields.\nFor data streams, these changes are applied to all backing indices by default.\n\n**Add multi-fields to an existing field**\n\nMulti-fields let you index the same field in different ways.\nYou can use this API to update the fields mapping parameter and enable multi-fields for an existing field.\nWARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.\nYou can populate the new multi-field with the update by query API.\n\n**Change supported mapping parameters for an existing field**\n\nThe documentation for each mapping parameter indicates whether you can update it for an existing field using this API.\nFor example, you can use the update mapping API to update the `ignore_above` parameter.\n\n**Change the mapping of an existing field**\n\nExcept for supported mapping parameters, you can't change the mapping or field type of an existing field.\nChanging an existing field could invalidate data that's already indexed.\n\nIf you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.\nIf you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.\n\n**Rename a field**\n\nRenaming a field would invalidate data already indexed under the old field name.\nInstead, add an alias field to create an alternate field name.\n\n## Required authorization\n\n* Index privileges: `manage`\n", + "description": "Add new fields to an existing data stream or index.\nYou can use the update mapping API to:\n\n- Add a new field to an existing index\n- Update mappings for multiple indices in a single request\n- Add new properties to an object field\n- Enable multi-fields for an existing field\n- Update supported mapping parameters\n- Change a field's mapping using reindexing\n- Rename a field using a field alias\n\nLearn how to use the update mapping API with practical examples in the [Update mapping API examples](https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples) guide.\n\n## Required authorization\n\n* Index privileges: `manage`\n", "externalDocs": { "url": "https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-parameters" }, diff --git a/output/schema/schema.json b/output/schema/schema.json index 891deb3c4f..94bb984d9d 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8245,7 +8245,7 @@ "stability": "stable" } }, - "description": "Update field mappings.\nAdd new fields to an existing data stream or index.\nYou can also use this API to change the search settings of existing fields and add new properties to existing object fields.\nFor data streams, these changes are applied to all backing indices by default.\n\n**Add multi-fields to an existing field**\n\nMulti-fields let you index the same field in different ways.\nYou can use this API to update the fields mapping parameter and enable multi-fields for an existing field.\nWARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.\nYou can populate the new multi-field with the update by query API.\n\n**Change supported mapping parameters for an existing field**\n\nThe documentation for each mapping parameter indicates whether you can update it for an existing field using this API.\nFor example, you can use the update mapping API to update the `ignore_above` parameter.\n\n**Change the mapping of an existing field**\n\nExcept for supported mapping parameters, you can't change the mapping or field type of an existing field.\nChanging an existing field could invalidate data that's already indexed.\n\nIf you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.\nIf you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.\n\n**Rename a field**\n\nRenaming a field would invalidate data already indexed under the old field name.\nInstead, add an alias field to create an alternate field name.", + "description": "Update field mappings.\nAdd new fields to an existing data stream or index.\nYou can use the update mapping API to:\n\n- Add a new field to an existing index\n- Update mappings for multiple indices in a single request\n- Add new properties to an object field\n- Enable multi-fields for an existing field\n- Update supported mapping parameters\n- Change a field's mapping using reindexing\n- Rename a field using a field alias\n\nLearn how to use the update mapping API with practical examples in the [Update mapping API examples](https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples) guide.", "docId": "indices-put-mapping", "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-mapping", "extDocId": "mapping-params", @@ -52985,8 +52985,7 @@ }, { "kind": "type_alias", - "docId": "node-roles", - "docUrl": "https://www.elastic.co/docs/reference/elasticsearch/configuration-reference/node-settings#node-roles", + "description": "* @doc_id node-roles", "name": { "name": "NodeRoles", "namespace": "_types" @@ -152291,7 +152290,7 @@ } ] }, - "description": "Update field mappings.\nAdd new fields to an existing data stream or index.\nYou can also use this API to change the search settings of existing fields and add new properties to existing object fields.\nFor data streams, these changes are applied to all backing indices by default.\n\n**Add multi-fields to an existing field**\n\nMulti-fields let you index the same field in different ways.\nYou can use this API to update the fields mapping parameter and enable multi-fields for an existing field.\nWARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.\nYou can populate the new multi-field with the update by query API.\n\n**Change supported mapping parameters for an existing field**\n\nThe documentation for each mapping parameter indicates whether you can update it for an existing field using this API.\nFor example, you can use the update mapping API to update the `ignore_above` parameter.\n\n**Change the mapping of an existing field**\n\nExcept for supported mapping parameters, you can't change the mapping or field type of an existing field.\nChanging an existing field could invalidate data that's already indexed.\n\nIf you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.\nIf you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.\n\n**Rename a field**\n\nRenaming a field would invalidate data already indexed under the old field name.\nInstead, add an alias field to create an alternate field name.", + "description": "Update field mappings.\nAdd new fields to an existing data stream or index.\nYou can use the update mapping API to:\n\n- Add a new field to an existing index\n- Update mappings for multiple indices in a single request\n- Add new properties to an object field\n- Enable multi-fields for an existing field\n- Update supported mapping parameters\n- Change a field's mapping using reindexing\n- Rename a field using a field alias\n\nLearn how to use the update mapping API with practical examples in the [Update mapping API examples](https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples) guide.", "examples": { "indicesPutMappingRequestExample1": { "alternatives": [ @@ -152426,7 +152425,7 @@ } } ], - "specLocation": "indices/put_mapping/IndicesPutMappingRequest.ts#L41-L181" + "specLocation": "indices/put_mapping/IndicesPutMappingRequest.ts#L41-L165" }, { "kind": "response", diff --git a/specification/indices/put_mapping/IndicesPutMappingRequest.ts b/specification/indices/put_mapping/IndicesPutMappingRequest.ts index c138fb1a45..cd027d552c 100644 --- a/specification/indices/put_mapping/IndicesPutMappingRequest.ts +++ b/specification/indices/put_mapping/IndicesPutMappingRequest.ts @@ -41,33 +41,17 @@ import { Dictionary, SingleKeyDictionary } from '@spec_utils/Dictionary' /** * Update field mappings. * Add new fields to an existing data stream or index. - * You can also use this API to change the search settings of existing fields and add new properties to existing object fields. - * For data streams, these changes are applied to all backing indices by default. - * - * **Add multi-fields to an existing field** - * - * Multi-fields let you index the same field in different ways. - * You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. - * WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. - * You can populate the new multi-field with the update by query API. - * - * **Change supported mapping parameters for an existing field** - * - * The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. - * For example, you can use the update mapping API to update the `ignore_above` parameter. - * - * **Change the mapping of an existing field** - * - * Except for supported mapping parameters, you can't change the mapping or field type of an existing field. - * Changing an existing field could invalidate data that's already indexed. - * - * If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. - * If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index. - * - * **Rename a field** - * - * Renaming a field would invalidate data already indexed under the old field name. - * Instead, add an alias field to create an alternate field name. + * You can use the update mapping API to: + + * - Add a new field to an existing index + * - Update mappings for multiple indices in a single request + * - Add new properties to an object field + * - Enable multi-fields for an existing field + * - Update supported mapping parameters + * - Change a field's mapping using reindexing + * - Rename a field using a field alias + * + * Learn how to use the update mapping API with practical examples in the [Update mapping API examples](https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples) guide. * @rest_spec_name indices.put_mapping * @availability stack stability=stable * @availability serverless stability=stable visibility=public