Create or update mappings
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 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 .
The request body must contain , which has all of the mappings that you want to create or update.
Optionally, you can add query parameters to make a more specific request. For example, to skip any missing or closed indexes in the response, you can add the ignore_unavailable
query parameter to your request as follows:
Sample Request
The following request creates a new mapping for the sample-index
index:
Sample Response
Upon success, the response returns "acknowledged": true
.