From 92658806ef549299cbf7fb7fe22271de6108e688 Mon Sep 17 00:00:00 2001 From: alicejw Date: Mon, 11 Apr 2022 18:17:16 -0700 Subject: [PATCH 1/6] to merge content and delete duplicate file - fix for issue https://github.com/opensearch-project/documentation-website/issues/485 Signed-off-by: alicejw --- .../rest-api/index-apis/put-mapping.md | 76 ------------------- .../rest-api/index-apis/update-mapping.md | 4 +- 2 files changed, 3 insertions(+), 77 deletions(-) delete mode 100644 _opensearch/rest-api/index-apis/put-mapping.md diff --git a/_opensearch/rest-api/index-apis/put-mapping.md b/_opensearch/rest-api/index-apis/put-mapping.md deleted file mode 100644 index 771a7a42..00000000 --- a/_opensearch/rest-api/index-apis/put-mapping.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -layout: default -title: Put mapping -parent: Index APIs -grand_parent: REST API reference -nav_order: 200 ---- - -# Put mapping -Introduced 1.0 -{: .label .label-purple } - -The put mapping API operation lets you add new mappings and fields to an index. - -## Example - -```json -PUT /sample-index/_mapping -{ - "properties": { - "age": { - "type": "integer" - }, - "occupation":{ - "type": "text" - } - } -} -``` - - -## Path and HTTP methods - -``` -PUT //_mapping -PUT /_mapping -``` - -## URL parameters - -All put mapping parameters are optional. - -Parameter | Data Type | Description -:--- | :--- | :--- -<target-index> | Data Type | The index to add the mapping to. If you do not specify this parameter, OpenSearch adds the mapping to all indices within the cluster. -allow_no_indices | Boolean | Whether to ignore wildcards that don’t match any indices. Default is `true`. -expand_wildcards | String | Expands wildcard expressions to different indices. Combine multiple values with commas. Available values are `all` (match all indices), `open` (match open indices), `closed` (match closed indices), `hidden` (match hidden indices), and `none` (do not accept wildcard expressions), which must be used with `open`, `closed`, or both. Default is `open`. -ignore_unavailable | Boolean | If true, OpenSearch does not include missing or closed indices in the response. -master_timeout | Time | How long to wait for a connection to the master node. Default is `30s`. -timeout | Time | How long to wait for a response from the cluster. Default is `30s`. -write_index_only | Boolean | Whether OpenSearch should add the mapping only to write indexes. If false, OpenSearch can add the mapping to all indexes with the same alias. See [alias]({{site.url}}{{site.baseurl}}/opensearch/rest-api/alias/#request-body) for more information. Default is false. - -## Request body - -The request body must contain the `properties` object, which has all of the mappings that you want to add. - -```json -{ - "properties":{ - "color":{ - "type": "text" - }, - "year":{ - "type": "integer" - } - } -} -``` - -## Response - -```json -{ - "acknowledged": true -} -``` diff --git a/_opensearch/rest-api/index-apis/update-mapping.md b/_opensearch/rest-api/index-apis/update-mapping.md index 22f4aa9a..50ec1342 100644 --- a/_opensearch/rest-api/index-apis/update-mapping.md +++ b/_opensearch/rest-api/index-apis/update-mapping.md @@ -12,7 +12,7 @@ Introduced 1.0 If you want to update an index's mappings to add or update field types after index creation, you can do so with the update mapping API operation. -Note that you cannot use this operation to update mappings that already map to existing data in the index. You must first create a new index with your desired mappings, and then use the [reindex API operation]({{site.url}}{{site.baseurl}}/opensearch/reindex-data) to map all the documents from your old index to the new index. If you don't want any downtime while reindexing your indices, you can use [aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias). +**Note:** You can't use this operation to update mappings that already map to existing data in the index. You must first create a new index with your desired mappings, and then use the [reindex API operation]({{site.url}}{{site.baseurl}}/opensearch/reindex-data) to map all the documents from your old index to the new index. If you don't want any downtime while you re-index your indices, you can use [aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias). ## Example @@ -36,6 +36,7 @@ PUT /sample-index/_mapping ``` PUT //_mapping +PUT /_mapping ``` You can also use the update mapping operation to update multiple indices with one request. @@ -50,6 +51,7 @@ All update mapping parameters are optional. Parameter | Data Type | Description :--- | :--- | :--- +<target-index> | Data Type | The index to add the mapping to. If you do not specify this parameter, OpenSearch adds the mapping to all indices within the cluster. allow_no_indices | Boolean | Whether to ignore wildcards that don’t match any indices. Default is `true`. expand_wildcards | String | Expands wildcard expressions to different indices. Combine multiple values with commas. Available values are `all` (match all indices), `open` (match open indices), `closed` (match closed indices), `hidden` (match hidden indices), and `none` (do not accept wildcard expressions), which must be used with `open`, `closed`, or both. Default is `open`. ignore_unavailable | Boolean | If true, OpenSearch does not include missing or closed indices in the response. From 2aba05aa0d3eee8fb2b6e8f79e9e08d63711eec3 Mon Sep 17 00:00:00 2001 From: alicejw Date: Tue, 12 Apr 2022 14:09:46 -0700 Subject: [PATCH 2/6] for review comments Signed-off-by: alicejw --- _opensearch/rest-api/index-apis/update-mapping.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_opensearch/rest-api/index-apis/update-mapping.md b/_opensearch/rest-api/index-apis/update-mapping.md index 50ec1342..0a1ea8e0 100644 --- a/_opensearch/rest-api/index-apis/update-mapping.md +++ b/_opensearch/rest-api/index-apis/update-mapping.md @@ -10,9 +10,9 @@ nav_order: 220 Introduced 1.0 {: .label .label-purple } -If you want to update an index's mappings to add or update field types after index creation, you can do so with the update mapping API operation. +If you want to add or update field types to an existing index, you can use the update mapping API operation. -**Note:** You can't use this operation to update mappings that already map to existing data in the index. You must first create a new index with your desired mappings, and then use the [reindex API operation]({{site.url}}{{site.baseurl}}/opensearch/reindex-data) to map all the documents from your old index to the new index. If you don't want any downtime while you re-index your indices, you can use [aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias). +You can't use this operation to update mappings that already map to existing data in the index. You must first create a new index with your desired mappings, and then use the [reindex API operation]({{site.url}}{{site.baseurl}}/opensearch/reindex-data) to map all the documents from your old index to the new index. If you don't want any downtime while you re-index your indexes, you can use [aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias). ## Example @@ -51,10 +51,10 @@ All update mapping parameters are optional. Parameter | Data Type | Description :--- | :--- | :--- -<target-index> | Data Type | The index to add the mapping to. If you do not specify this parameter, OpenSearch adds the mapping to all indices within the cluster. -allow_no_indices | Boolean | Whether to ignore wildcards that don’t match any indices. Default is `true`. -expand_wildcards | String | Expands wildcard expressions to different indices. Combine multiple values with commas. Available values are `all` (match all indices), `open` (match open indices), `closed` (match closed indices), `hidden` (match hidden indices), and `none` (do not accept wildcard expressions), which must be used with `open`, `closed`, or both. Default is `open`. -ignore_unavailable | Boolean | If true, OpenSearch does not include missing or closed indices in the response. +<target-index> | N/A | The index to add the mapping to. If you do not specify this parameter, OpenSearch adds the mapping to all indexes within the cluster. +allow_no_indices | Boolean | Whether to ignore wildcards that don’t match any indexes. Default is `true`. +expand_wildcards | String | Expands wildcard expressions to different indexes. Combine multiple values with commas. Available values are `all` (match all indexes), `open` (match open indexes), `closed` (match closed indexes), `hidden` (match hidden indexes), and `none` (do not accept wildcard expressions), which must be used with `open`, `closed`, or both. Default is `open`. +ignore_unavailable | Boolean | If true, OpenSearch does not include missing or closed indexes in the response. master_timeout | Time | How long to wait for a connection to the master node. Default is `30s`. timeout | Time | How long to wait for the response to return. Default is `30s`. write_index_only | Boolean | Whether OpenSearch should apply mapping updates only to the write index. From 4b5b7062204e0b4d41b7933016d949339be3c3ac Mon Sep 17 00:00:00 2001 From: alicejw Date: Wed, 13 Apr 2022 09:44:58 -0700 Subject: [PATCH 3/6] for topic title and description of API function Signed-off-by: alicejw --- _opensearch/rest-api/index-apis/update-mapping.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_opensearch/rest-api/index-apis/update-mapping.md b/_opensearch/rest-api/index-apis/update-mapping.md index 0a1ea8e0..3731a3ab 100644 --- a/_opensearch/rest-api/index-apis/update-mapping.md +++ b/_opensearch/rest-api/index-apis/update-mapping.md @@ -6,11 +6,11 @@ grand_parent: REST API reference nav_order: 220 --- -# Update mapping +# Create or update mappings Introduced 1.0 {: .label .label-purple } -If you want to add or update field types to an existing index, you can use the update mapping API operation. +If you want to create or add mappings and fields to an index, you can use the put mapping API operation. You can't use this operation to update mappings that already map to existing data in the index. You must first create a new index with your desired mappings, and then use the [reindex API operation]({{site.url}}{{site.baseurl}}/opensearch/reindex-data) to map all the documents from your old index to the new index. If you don't want any downtime while you re-index your indexes, you can use [aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias). @@ -39,7 +39,7 @@ PUT //_mapping PUT /_mapping ``` -You can also use the update mapping operation to update multiple indices with one request. +You can also use the put mapping operation to update multiple indexes with one request. ``` PUT /,/_mapping @@ -51,7 +51,7 @@ All update mapping parameters are optional. Parameter | Data Type | Description :--- | :--- | :--- -<target-index> | N/A | The index to add the mapping to. If you do not specify this parameter, OpenSearch adds the mapping to all indexes within the cluster. +<target-index> | N/A | Specifies an index to associate the mapping. If you do not specify this parameter, OpenSearch adds the mapping to all indexes within the cluster. allow_no_indices | Boolean | Whether to ignore wildcards that don’t match any indexes. Default is `true`. expand_wildcards | String | Expands wildcard expressions to different indexes. Combine multiple values with commas. Available values are `all` (match all indexes), `open` (match open indexes), `closed` (match closed indexes), `hidden` (match hidden indexes), and `none` (do not accept wildcard expressions), which must be used with `open`, `closed`, or both. Default is `open`. ignore_unavailable | Boolean | If true, OpenSearch does not include missing or closed indexes in the response. From 0bf76386a5081dcc66b6fd21ccce053ae8cfed35 Mon Sep 17 00:00:00 2001 From: alicejw Date: Wed, 13 Apr 2022 09:46:38 -0700 Subject: [PATCH 4/6] to rename file to match api function Signed-off-by: alicejw --- .../rest-api/index-apis/{update-mapping.md => put-mapping.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename _opensearch/rest-api/index-apis/{update-mapping.md => put-mapping.md} (100%) diff --git a/_opensearch/rest-api/index-apis/update-mapping.md b/_opensearch/rest-api/index-apis/put-mapping.md similarity index 100% rename from _opensearch/rest-api/index-apis/update-mapping.md rename to _opensearch/rest-api/index-apis/put-mapping.md From fc278e9b98709689ec086870ae93ee578ca3c489 Mon Sep 17 00:00:00 2001 From: alicejw Date: Wed, 13 Apr 2022 10:00:21 -0700 Subject: [PATCH 5/6] modify left nav entry to match new topic name Signed-off-by: alicejw --- _opensearch/rest-api/index-apis/put-mapping.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_opensearch/rest-api/index-apis/put-mapping.md b/_opensearch/rest-api/index-apis/put-mapping.md index 3731a3ab..de27e932 100644 --- a/_opensearch/rest-api/index-apis/put-mapping.md +++ b/_opensearch/rest-api/index-apis/put-mapping.md @@ -1,6 +1,6 @@ --- layout: default -title: Update mapping +title: Create or update mappings parent: Index APIs grand_parent: REST API reference nav_order: 220 From 32b5b0771f0b2e15aebdacb55f73e234b01f8629 Mon Sep 17 00:00:00 2001 From: alicejw Date: Wed, 13 Apr 2022 10:42:31 -0700 Subject: [PATCH 6/6] for additional reviewer suggestions Signed-off-by: alicejw --- _opensearch/rest-api/index-apis/put-mapping.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_opensearch/rest-api/index-apis/put-mapping.md b/_opensearch/rest-api/index-apis/put-mapping.md index de27e932..3096baa8 100644 --- a/_opensearch/rest-api/index-apis/put-mapping.md +++ b/_opensearch/rest-api/index-apis/put-mapping.md @@ -10,7 +10,7 @@ nav_order: 220 Introduced 1.0 {: .label .label-purple } -If you want to create or add mappings and fields to an index, you can use the put mapping API operation. +If you want to create or add mappings and fields to an index, you can use the put mapping API operation. For an existing mapping, this operation updates the mapping. You can't use this operation to update mappings that already map to existing data in the index. You must first create a new index with your desired mappings, and then use the [reindex API operation]({{site.url}}{{site.baseurl}}/opensearch/reindex-data) to map all the documents from your old index to the new index. If you don't want any downtime while you re-index your indexes, you can use [aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias). @@ -47,11 +47,11 @@ PUT /,/_mapping ## URL parameters -All update mapping parameters are optional. +All put mapping parameters are optional. Parameter | Data Type | Description :--- | :--- | :--- -<target-index> | N/A | Specifies an index to associate the mapping. If you do not specify this parameter, OpenSearch adds the mapping to all indexes within the cluster. +<target-index> | N/A | Specifies an index with which to associate the mapping. If you do not specify this parameter, OpenSearch adds the mapping to all indexes within the cluster. allow_no_indices | Boolean | Whether to ignore wildcards that don’t match any indexes. Default is `true`. expand_wildcards | String | Expands wildcard expressions to different indexes. Combine multiple values with commas. Available values are `all` (match all indexes), `open` (match open indexes), `closed` (match closed indexes), `hidden` (match hidden indexes), and `none` (do not accept wildcard expressions), which must be used with `open`, `closed`, or both. Default is `open`. ignore_unavailable | Boolean | If true, OpenSearch does not include missing or closed indexes in the response. @@ -61,7 +61,7 @@ write_index_only | Boolean | Whether OpenSearch should apply mapping updates onl ## Request body -The request body must contain `properties`, which has all of the mappings that you want to update. +The request body must contain `properties`, which has all of the mappings that you want to create or update. ```json {