Skip to main content
This page documents an earlier version of the API client. For the latest version, see Create or replace synonyms.
Required ACL: editSettings This method lets you create or update one or more synonyms in a single call. You can also recreate your entire set of synonyms by using the replaceExistingSynonyms parameter.
Each synonym object counts as a single indexing operation.

Examples

List<Synonym> synonyms = new List<Synonym>
{
    new Synonym
    {
      ObjectID = "synonymID1",
      Type = "synonym",
      Synonyms = new List<string> { "car", "vehicle", "auto" }
    },
    new Synonym
    {
      ObjectID = "synonymID2",
      Type = "synonym",
      Synonyms = new List<string> { "street", "st" }
    }
};

index.SaveSynonyms(synonyms, forwardToreplicas: true, replaceExistingSynonyms: true);

// Asynchronous
await index.SaveSynonymsAsync(synonyms, forwardToreplicas: true, replaceExistingSynonyms: true);

Parameters

synonyms
synonym[]
required
List of synonyms to add or update. For details about the expected shape of the synonym object, see synonym.
forwardToReplicas
boolean
default:false
Whether to add synonyms to all replica indices.
replaceExistingSynonyms
boolean
default:false
Whether to delete all synonyms before adding new ones.Use this option if you want to replace your existing synonyms with the ones provided with this method.

Response

taskID
integer
The task ID used with the waitTask method.
updatedAt
string
Date at which the indexing job has been created.

Response as JSON

This section shows the JSON response returned by the API. Each API client wraps this response in language-specific objects, so the structure may vary. To view the response, use the getLogs method. Don’t rely on the order of properties—JSON objects don’t preserve key order.
JSON
{
  "updatedAt":"2013-01-18T15:33:13.556Z",
  "taskID": 678
}
I