> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Clear all synonyms

> Remove all synonyms from an index.

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

<Legacy title="Delete all synonyms" href="/doc/libraries/sdk/methods/search/clear-synonyms" />

**Required ACL:** `editSettings`

**Don't use this method to replace all synonyms in your production indices.**
Doing so causes a short downtime during which the index has no synonyms.

Instead, use [`saveSynonyms`](/doc/libraries/sdk/v1/methods/save-synonyms) with the `replaceExistingSynonyms` option to replace all synonyms without downtime.

## Examples

<CodeGroup>
  ```cs C# theme={"system"}
  index.ClearSynonyms(forwardToReplicas: true);

  // Asynchronous
  await index.ClearSynonymsAsync(forwardToReplicas: true);
  ```

  ```go Go theme={"system"}
  forwardToReplicas := opt.ForwardToReplicas(true)
  res, err := index.ClearSynonyms(forwardToReplicas)
  ```

  ```java Java theme={"system"}
  boolean forwardToReplicas = true;

  index.clearSynonyms(forwardToReplicas);

  // Asynchronous
  index.clearSynonymsAsync(forwardToReplicas);
  ```

  ```js JavaScript theme={"system"}
  index.clearSynonyms({ forwardToReplicas: true }).then(() => {
    // done
  });
  ```

  ```kotlin Kotlin theme={"system"}
  index.clearSynonyms(forwardToReplicas = true)
  ```

  ```php PHP theme={"system"}
  $index->clearSynonyms([
    'forwardToReplicas' => true
  ]);
  ```

  ```python Python theme={"system"}
  # Clear synonyms and forward to replicas
  index.clear_synonyms({
      'forwardToReplicas': True
  })
  ```

  ```ruby Ruby theme={"system"}
  # Clear synonyms and forward to replicas
  index.clear_synonyms({ forwardToReplicas: true })
  ```

  ```scala Scala theme={"system"}
  client.execute {
    clear synonyms of index "index_name" and forwardToReplicas
  }
  ```

  ```swift Swift theme={"system"}
  index.clearSynonyms(forwardToReplicas: true) { result in
    if case .success(let response) = result {
      print("Response: \(response)")
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="forwardToReplicas" type="boolean" default={false}>
  Whether to delete all synonyms from all replicas of the index.
</ParamField>

## Response

<ResponseField name="taskID" type="integer">
  The task ID used with the [`waitTask`](/doc/libraries/sdk/v1/methods/wait-task) method.
</ResponseField>

<ResponseField name="updatedAt" type="string">
  Date at which the indexing job has been created.
</ResponseField>

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

```jsonc JSON icon=braces theme={"system"}
{
  "updatedAt":"2013-01-18T15:33:13.556Z",
  "taskID": 678
}
```
