Api clients / Ruby / V1 / Methods

Replace All Synonyms | Ruby API Client V1 (Deprecated)

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

Required API Key: any key with the editSettings ACL
Method signature
index.replace_all_synonyms(Array synonyms)
index.replace_all_synonyms(Array synonyms, {
  'forwardToReplicas': Boolean
})

About this method# A

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# A

Replace all synonyms#

1
2
3
4
5
6
7
8
9
10
11
12
client = Algolia::Client.new({
    :application_id => 'AJ0P3S7DWQ',
    :api_key => '••••••••••••••••••••'
})

synonyms = [] # Fetch your synonyms

index = client.init_index('your_index_name')
index.replace_all_synonyms(synonyms)

# Or if you want to also replace synonyms on replicas
index.replace_all_synonyms(synonyms, {'forwardToReplicas': true})

Parameters# A

synonyms #
type: list
Required

A list of synonyms

forwardToReplicas #
type: boolean
default: false
Optional

Also replace synonyms on replicas

requestOptions #
type: key/value mapping
default: No request options
Optional

A mapping of request options to send along with the request.

Response# A

No response.

Did you find this page helpful?