/**
  * Put Mapping.
  *
  * @param bool $ignoreConflicts
  *
  * @return array
  */
 public static function putMapping($ignoreConflicts = false)
 {
     $instance = new static();
     $mapping = $instance->getBasicEsParams();
     $params = array('_source' => array('enabled' => true), 'properties' => $instance->getMappingProperties());
     $mapping['body'][$instance->getTypeName()] = $params;
     return $instance->getElasticSearchClient()->indices()->putMapping($mapping);
 }
 /**
  * Create Index
  *
  * @param int $shards
  * @param int $replicas
  *
  * @return array
  */
 public static function createIndex($shards = null, $replicas = null)
 {
     $instance = new static();
     $client = $instance->getElasticSearchClient();
     $index = array('index' => $instance->getIndexName());
     $settings = $instance->getIndexSettings();
     if (!is_null($settings)) {
         $index['body']['settings'] = $settings;
     }
     if (!is_null($shards)) {
         $index['body']['settings']['number_of_shards'] = $shards;
     }
     if (!is_null($replicas)) {
         $index['body']['settings']['number_of_replicas'] = $replicas;
     }
     $mappingProperties = $instance->getMappingProperties();
     if (!is_null($mappingProperties)) {
         $index['body']['mappings'][$instance->getTypeName()] = ['_source' => array('enabled' => true), 'properties' => $mappingProperties];
     }
     return $client->indices()->create($index);
 }
 /**
  * Put Mapping
  *
  * @param    bool $ignoreConflicts
  * @return   array
  */
 public static function putMapping($ignoreConflicts = false)
 {
     $instance = new static();
     $params = array('index' => $instance->getIndexName() . '_write', 'type' => $instance->getTypeName(), 'body' => ['properties' => $instance->getMappingProperties()]);
     return $instance->getElasticSearchClient()->indices()->putMapping($params);
 }