Api clients / JavaScript / V3 / Methods

Replace All Synonyms | JavaScript API Client V3 (Deprecated)

This version of the JavaScript API client has been deprecated in favor of the latest version of the JavaScript API client.

Required API Key: any key with the editSettings ACL
Method signature
Not implemented yet.

About this method

Push a new set of synonyms and erase all previous ones.

This method, like replaceAllObjects, guarantees zero downtime.

All existing synonyms are deleted and replaced with the new ones, in a single, atomic operation.

Examples

Replace all synonyms

1
2
3
4
5
6
7
8
9
10
11
12
$client = Algolia\AlgoliaSearch\SearchClient::create(
  'YourApplicationID',
  'YourAdminAPIKey'
);

$synonyms = /* Fetch your synonyms */;

$index = $client->initIndex('your_index_name');
$index->replaceAllSynonyms($synonyms);

// Or if you want to also replace synonyms on replicas
$index->replaceAllSynonyms($synonyms, ['forwardToReplicas' => true]);

Parameters

synonyms
type: list
Required

A list of synonyms

forwardToReplicas
type: boolean
default: false
Optional

Also replace synonyms on replicas

Response

No response.

Did you find this page helpful?