final public function updateIndex(Client $client, string $name): void
    {
        $index = new Index($client, $name);

        foreach ($this->createMappings() as $typeName => $mapping) {
            try {
                $mapping->setType(new Type($index, $typeName));
                $mapping->send();
            } catch (\Throwable $e) {
                if (false !== strpos($e->getMessage(), 'no such index')) {
                    $this->logger->info(
                        sprintf('No index exists yet [%s/%s] in ElasticSearch.  Ignoring.', $name, $typeName)
                    );
                    return;
                }

                throw new EventSearchOperationFailed(
                    sprintf('Failed to put mapping for type [%s/%s] into ElasticSearch.', $name, $typeName),
                    Code::INTERNAL,
                    $e
                );
            }

            $this->logger->info(sprintf('Successfully put mapping for type [%s/%s]', $name, $typeName));
        }

        $this->updateAnalyzers($index, $name);
        $this->updateNormalizers($index, $name);
    }
final public function updateIndex(Client $client, string $name): void
    {
        $index = new Index($client, $name);

        foreach ($this->createMappings() as $typeName => $mapping) {
            try {
                $mapping->setType(new Type($index, $typeName));
                $mapping->send();
            } catch (\Throwable $e) {
                if (false !== strpos($e->getMessage(), 'no such index')) {
                    $this->logger->info(
                        sprintf('No index exists yet [%s/%s] in ElasticSearch.  Ignoring.', $name, $typeName)
                    );
                    return;
                }

                throw new EventSearchOperationFailed(
                    sprintf('Failed to put mapping for type [%s/%s] into ElasticSearch.', $name, $typeName),
                    Code::INTERNAL,
                    $e
                );
            }

            $this->logger->info(sprintf('Successfully put mapping for type [%s/%s]', $name, $typeName));
        }

        $this->updateAnalyzers($index, $name);
        $this->updateNormalizers($index, $name);
    }
final public function updateIndex ( Client $ client , string $ name ) : void { $ index = new Index ( $ client , $ name ) ; foreach ( $ this -> createMappings ( ) as $ typeName => $ mapping ) { try { $ mapping -> setType ( new Type ( $ index , $ typeName ) ) ; $ mapping -> send ( ) ; } catch ( \ Throwable $ e ) { if ( false !== strpos ( $ e -> getMessage ( ) , 'no such index' ) ) { $ this -> logger -> info ( sprintf ( 'No index exists yet [%s/%s] in ElasticSearch.  Ignoring.' , $ name , $ typeName ) ) ; return ; } throw new EventSearchOperationFailed ( sprintf ( 'Failed to put mapping for type [%s/%s] into ElasticSearch.' , $ name , $ typeName ) , Code :: INTERNAL , $ e ) ; } $ this -> logger -> info ( sprintf ( 'Successfully put mapping for type [%s/%s]' , $ name , $ typeName ) ) ; } $ this -> updateAnalyzers ( $ index , $ name ) ; $ this -> updateNormalizers ( $ index , $ name ) ; }
Updates an existing index settings and all of its mappings.
The index template handles this for any newly created indices but
the existing ones need to be updated directly.

This is generally only needed for indices that you're still actively
writing data to.  If this fails you'll need to delete the index and
re-index all data for that time frame.

The name can contain wildcards.

@param Client $client
@param string $name
Updates an existing index settings and all of its mappings . The index template handles this for any newly created indices but the existing ones need to be updated directly .