elasticsearchHow do I update a mapping in Elasticsearch?
Updating a mapping in Elasticsearch is a two-step process. First, you need to delete the existing mapping, and then you can add the new mapping.
Example code
# Delete existing mapping
curl -X DELETE localhost:9200/my_index
# Add new mapping
curl -X PUT localhost:9200/my_index -H 'Content-Type: application/json' -d '
{
"mappings": {
"properties": {
"title": {
"type": "text"
}
}
}
}'
Output example
{"acknowledged":true}
curl -X DELETE localhost:9200/my_index
: This command sends an HTTP DELETE request to the Elasticsearch server running on localhost:9200 for the index named my_index.curl -X PUT localhost:9200/my_index
: This command sends an HTTP PUT request to the Elasticsearch server running on localhost:9200 for the index named my_index.-H 'Content-Type: application/json'
: This specifies the content type of the request body as JSON.-d '<mapping>'
: This specifies the mapping to be added to the index.
Helpful links
More of Elasticsearch
- How do I use an elasticsearch query builder?
- How can I use Elasticsearch and ZFS together?
- How can I use Yandex Mirror to access Elasticsearch data?
- How can I use Elasticsearch and Zookeeper together to manage distributed applications?
- How can I use Elasticsearch to diagnose "yellow" issues?
- How can I use Elasticsearch and Zabbix together for software development?
- How do I set up an Elasticsearch Yum repository?
- How can I use YouTube to learn about Elasticsearch?
- How can I use elasticsearch zone awareness to improve my software development?
- How do I configure elasticsearch to use an XMS memory allocator?
See more codes...