private function closeIndex(Client $client, $indexName)
    {
        try {
            $path = sprintf('%s/_close', $indexName);
            $client->request($path, Request::POST);
        } catch (ExceptionInterface $e) {
            throw new \RuntimeException(
                sprintf(
                    'Failed to close index %s with message: %s',
                    $indexName,
                    $e->getMessage()
                ),
                0,
                $e
            );
        }
    }