final public function createIndex(Client $client, SchemaQName $qname, array $context = []): Index
    {
        static $created = [];

        $indexName = $this->getIndexName($qname, $context);
        if (isset($created[$indexName])) {
            return $created[$indexName];
        }

        $index = $created[$indexName] = $client->getIndex($indexName);
        $type = $this->types[$qname->toString()] ?? $this->types['default'];
        $mapper = $this->getNodeMapper($qname);
        $settings = $this->filterIndexSettings($this->indexes[$type['index_name'] ?? 'default'], $qname, $context);
        unset($settings['fq_index_name']);

        try {
            if (!$index->exists()) {
                $settings['analysis'] = [
                    'analyzer'   => $mapper->getCustomAnalyzers(),
                    'normalizer' => $mapper->getCustomNormalizers(),
                ];

                $index->create($settings);
            }
        } catch (\Throwable $e) {
            throw new SearchOperationFailed(
                sprintf(
                    '%s while creating index [%s] for qname [%s].',
                    ClassUtils::getShortName($e),
                    $index->getName(),
                    $qname
                ),
                Code::INTERNAL,
                $e
            );
        }

        return $index;
    }