I want to change the type of a field from 'string' to 'date' (format: 'epoch_second' to be specific). Since there is no way to update the mappings of an existing index, I need to make a new index for which I mostly want to use the mapping from my existing index. Here is what I am using:
curl -XGET 'http://localhost:9200/sam/saga/_mapping?pretty' >saga.json
to dump the mapping of the current index into a json file, the content of which is this:
{
"sam" : {
"mappings" : {
"saga" : {
"properties" : {
"name" : {
"type" : "long"
}
}
}
}
}
}
then I replace
"name" : {
"type" : "long"
}
with
"name" : {
"type" : "date"
}
and save the new file as saga2.json. then run this
curl -XPUT 'http://localhost:9200/sam/_mapping/saga2' -d @saga2.json
However, when I check the mapping of the new index, all types have changed to "string" now.
I even have this problem using the Elasticsearch's example.
Does anyone know what is wrong?