Changing datatype


(Thanigaivelan) #1

Hi,

How can we change the mapped data type , from string to integer.

$ curl -XPUT 'http://localhost:9200/songs/song/_mapping' -d '
{
"song" : {
"properties" : {
"position" : {"type" : "integer"}
}
}
}

When i had tried this, i am getting error

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [position] cannot be changed from type [string] to [int]"}],"type":"illegal_argument_exception","reason":"mapper [position] cannot be changed from type [string] to [int]"},"status":400}

Thanks

Thanigaivelan


(Mark Walkom) #2

You need to reindex the data, you cannot just change it.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.