简体   繁体   English

如何使用Algolia php客户端创建副本?

[英]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". 这将创建2个新索引“ products_name_asc”和“ products_name_desc”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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