updateAliases example



        $actions = [
            ['add' => ['index' => $indexName, 'alias' => $index->getName()]],
        ];

        $current = $client->indices()->getAlias(['name' => $index->getName()]);
        $current = array_keys($current);
        foreach ($current as $value) {
            $actions[] = ['remove' => ['index' => $value, 'alias' => $index->getName()]];
        }
        $client->indices()->updateAliases(['body' => ['actions' => $actions]]);

        return 0;
    }
}

        $actions = [
            ['add' => ['index' => $configuration->getName(), 'alias' => $configuration->getAlias()]],
        ];

        $current = $this->client->indices()->getAlias(['name' => $configuration->getAlias()]);
        $current = array_keys($current);

        foreach ($current as $value) {
            $actions[] = ['remove' => ['index' => $value, 'alias' => $configuration->getAlias()]];
        }
        $this->client->indices()->updateAliases(['body' => ['actions' => $actions]]);
    }
}

        $actions = [
            ['add' => ['index' => $index, 'alias' => $alias]],
        ];

        $current = $this->client->indices()->getAlias(['name' => $alias]);
        $current = array_keys($current);

        foreach ($current as $value) {
            $actions[] = ['remove' => ['index' => $value, 'alias' => $alias]];
        }
        $this->client->indices()->updateAliases(['body' => ['actions' => $actions]]);
    }

    private function createMapping(EsAwareRepository $entity, string $index): void
    {
        $mapping = [
            'properties' => [
                'id' => TypeMappingInterface::MAPPING_LONG_FIELD,
            ],
        ];

        $own = $entity->getMapping();

        
$actions = [
            ['add' => ['index' => $index, 'alias' => $alias]],
        ];

        $current = $this->client->indices()->getAlias(['name' => $alias]);
        $current = array_keys($current);

        foreach ($current as $value) {
            $actions[] = ['remove' => ['index' => $value, 'alias' => $alias]];
        }

        $this->client->indices()->updateAliases(['body' => ['actions' => $actions]]);
    }

    private function handleQueue(): void
    {
        /** * @deprecated tag:v6.6.0 - Will be removed */
        if (Feature::isActive('ES_MULTILINGUAL_INDEX')) {
            $this->keyValueStorage->set(ElasticsearchHelper::ENABLE_MULTILINGUAL_INDEX_KEY, 1);
        }

        
Home | Imprint | This part of the site doesn't use cookies.