How to change existing mapping in ElasticSearch using php?
my current mapping is as follows:
array(1) {
["profile_index"]=>
array(1) {
["mappings"]=>
array(1) {
["profile"]=>
array(1) {
["properties"]=>
array(19) {
["AboutMe"]=>
array(1) {
["type"]=>
string(6) "string"
}
["Name"]=>
array(1) {
["type"]=>
string(6) "string"
}
["IDProfile"]=>
array(1) {
["type"]=>
string(6) "string"
}
}
}
}
}
}
I want to change the IDProfile type to an integer. this:
$mapParams['index'] = 'profile_index';
$mapParams['type'] = 'profile';
$mapParams["body"]['profile'] = array("properties"=>array("A2_IDProfile"=>array("type"=>"integer")));
$client->indices()->putMapping($mapParams);
and its options do not work.
Any suggestions?
PS I use the official php clinet
You cannot change the type of index without reindexing. To test the solution https://www.elastic.co/blog/changing-mapping-with-zero-downtime