PHP example not working

Hello
in this page :
https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_index_management_operations.html#_put_settings_api

I try this example :

$client = ClientBuilder::create()->build();
$params = [
'index' => 'my_index',
'body' => [
'settings' => [
'number_of_shards' => 3,
'number_of_replicas' => 2
],
'mappings' => [
'my_type' => [
'_source' => [
'enabled' => true,
'properties' => [
'first_name' => [
'type' => 'string',
'analyzer' => 'standard'
],
'age' => [
'type' => 'integer'
]
]
]
]
]
]
];

// Create the index with mappings and settings now
$response = $client->indices()->create($params);

and I get an exception :

PHP Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Mapping definition for [_source] has unsupported parameters: [properties : {first_name={analyzer=standard, type=string}, age={type=integer}}]"}],"type":"mapper_parsing_exception","reason":"mapping [my_type]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [_source] has unsupported parameters: [properties : {first_name={analyzer=standard, type=string}, age={type=integer}}]"}},"status":400}' in /opt/MSF/development/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:613\nStack trace:\n#0 /opt/MSF/development/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(590): Elasticsearch\Connections\Connection->tryDeserializeError(Array, 'Elasticsearch\\C...')\n#1 /opt/MSF/development/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Con in /opt/MSF/development/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 615

what would be the right syntax, the first example of the tutorial works.
My version is 2.0.0
I'm a total newbee.
thank for helping me.
marc

Hi, Marc. Look at this example in Put Mappings API, maybe you should use this API to change index mapping.
In your example the _source and properties must not be nested.

Hi Rusty
That's it
the Example should be :

$params = [
'index' => 'my_index',
'body' => [
'settings' => [
'number_of_shards' => 3,
'number_of_replicas' => 2
],
'mappings' => [
'my_type' => [
'_source' => [
'enabled' => true
],
'properties' => [
'first_name' => [
'type' => 'string',
'analyzer' => 'standard'
],
'age' => [
'type' => 'integer'
]
]
]
]
]
];

thank you very much
marc