简体   繁体   中英

How to create replica with Algolia php client?

我正在尝试使用Algolia php客户端将副本索引链接到主索引,我在索引设置中找不到将索引标记为主索引副本的任何内容,只是在设置中将$ forwardToReplicas标记了出来,但没有创建和链接副本。

To create replicas you can use the "replicas" key in the settings.

<?php

$client = new \AlgoliaSearch\Client('application _id', 'api_key');
$index = $client->initIndex('index_name');
$index->setSettings([
    'replicas' => ['products_name_asc', 'products_name_desc']
]);

This will create 2 new indices "products_name_asc" and "products_name_desc".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM