Get Mappings API

edit

The Get Mappings API will return the mapping details about your indexes and types. Depending on the mappings that you wish to retrieve, you can specify a number of combinations of index and type:

// Get mappings for all indexes and types
$response = $client->indices()->getMapping();

// Get mappings for all types in 'my_index'
$params = ['index' => 'my_index'];
$response = $client->indices()->getMapping($params);

// Get mappings for all types of 'my_type', regardless of index
$params = ['type' => 'my_type' ];
$response = $client->indices()->getMapping($params);

// Get mapping 'my_type' in 'my_index'
$params = [
    'index' => 'my_index'
    'type' => 'my_type'
];
$response = $client->indices()->getMapping($params);

// Get mappings for two indexes
$params = [
    'index' => [ 'my_index', 'my_index2' ]
];
$response = $client->indices()->getMapping($params);