/** * Update the settings for the elasticsearch instance. * * @param array $settings */ public function updateSettings(array $settings) { $this->checkIndex(); $indices = $this->client->indices(); $toggle = ['index' => $this->config->getIndex()]; $indices->close($toggle); $settings = ['index' => $this->config->getIndex(), 'body' => $settings]; $indices->putSettings($settings); $indices->open($toggle); foreach ($this->config->getTypes() as $type) { /* @var Searchable $object */ $class = $this->config->getClass($type); $object = new $class(); $indices->putMapping(['index' => $this->config->getIndex(), 'type' => $type, 'body' => ['properties' => $object->getSearchableMapping($this->config->getWith($type))]]); } $indices->refresh($toggle); }