to merge content and delete duplicate file - fix for issue https://github.com/opensearch-project/documentation-website/issues/485

Signed-off-by: alicejw <alicejw@amazon.com>
This commit is contained in:
alicejw 2022-04-11 18:17:16 -07:00
parent 41eb61ecf2
commit 92658806ef
2 changed files with 3 additions and 77 deletions

View File

@ -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 /<target-index>/_mapping
PUT /_mapping
```
## URL parameters
All put mapping parameters are optional.
Parameter | Data Type | Description
:--- | :--- | :---
&lt;target-index&gt; | 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 dont 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
}
```

View File

@ -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 /<target-index>/_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
:--- | :--- | :---
&lt;target-index&gt; | 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 dont 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.