I found a solution:
$client = AlgoliaAlgoliaSearchSearchClient::create('APP_ID', 'APP_SECRET');
$index = $client->initIndex('MAIN_INDEX_NAME');
$attributesForFaceting = $index->getSettings()['attributesForFaceting'];
$attributesForFaceting[] = 'searchable('.$newAttributeName.')';
$index->setSettings([
'attributesForFaceting' => $attributesForFaceting
]);
foreach($index->getSettings()['replicas'] as $replicaName) {
$index = $client->initIndex($replicaName);
$index->setSettings([
'attributesForFaceting' => $attributesForFaceting
]);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…