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
$ret = $client->indices()->getMapping();

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

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

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

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