如何使用php改变ElasticSearch中现有的映射


How to change existing mapping in ElasticSearch using php?

我当前的映射是这样的:

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"
          }
        }
      }
    }
  }
}

我想将IDProfile的类型更改为整数。:

$mapParams['index'] = 'profile_index';
$mapParams['type'] = 'profile';
$mapParams["body"]['profile'] = array("properties"=>array("A2_IDProfile"=>array("type"=>"integer")));
$client->indices()->putMapping($mapParams);

和它的变体不起作用

有什么建议吗?

注:我使用的是官方PHP客户端

不重新索引就不能更改索引类型。查看https://www.elastic.co/blog/changing-mapping-with-zero-downtime