IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Create an index
editCreate an index
editNow that we are starting fresh (no data or index), let’s add a new index with some custom settings:
$params = [ 'index' => 'my_index', 'body' => [ 'settings' => [ 'number_of_shards' => 2, 'number_of_replicas' => 0 ] ] ]; $response = $client->indices()->create($params); print_r($response);
Elasticsearch will now create that index with your chosen settings, and return an acknowledgement:
Array ( [acknowledged] => 1 )