I've already created an index, and it contains data from my MySQL
database. I've got few fields which are string
in my table, where I need them as different types ( integer
& double
) in Elasticsearch
.
So I'm aware that I could do it through mapping
as follows:
{
"mappings": {
"my_type": {
"properties": {
"userid": {
"type": "text",
"fielddata": true
},
"responsecode": {
"type": "integer"
},
"chargeamount": {
"type": "double"
}
}
}
}
}
But I've tried this when I'm creating the index as a new one. What I wanted to know is how can I update an existing field (ie: chargeamount
in this scenario) using mapping
as a PUT
?
Is this possible? Any help could be appreciated.
Once a mapping type has been created, you're very constrained on what you can update. According to the official documentation , the only changes you can make to an existing mapping after it's been created are the following, but changing a field's type is not one of them:
In general, the mapping for existing fields cannot be updated. There are some exceptions to this rule. For instance:
- new properties can be added to Object datatype fields.
- new multi-fields can be added to existing fields.
- doc_values can be disabled, but not enabled.
- the ignore_above parameter can be updated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.