final public function updateTemplate(Client $client, string $name): void
    {
        $fakeIndex = new Index($client, $name);
        $mappings = [];
        foreach ($this->createMappings() as $typeName => $mapping) {
            $mapping->setType(new Type($fakeIndex, $typeName));
            $mappings[$typeName] = $mapping->toArray();
        }

        $params = [
            'template' => '*' . $name . '*',
            'settings' => [
                'number_of_shards'   => 1,
                'number_of_replicas' => 1,
                'index'              => [
                    'analysis' => [
                        'analyzer'   => $this->getCustomAnalyzers(),
                        'normalizer' => $this->getCustomNormalizers(),
                    ],
                ],
            ],
            'mappings' => $mappings,
        ];

        $this->beforeUpdateTemplate($params);
        $template = new IndexTemplate($client, $name);
        $template->create($params);
        $this->logger->info(sprintf('Successfully created index template [%s].', $params['template']));
    }