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

# Delete

## Delete Command for Python SDK

The delete method allows you to delete documents from your index using various criteria.

### Arguments

<ResponseField name="DeletePayload" type="object" required>
  <Expandable defaultOpen="true">
    <ResponseField name="ids" type="string[] | number[] | string | number">
      One or more document IDs to delete.
    </ResponseField>

    <ResponseField name="prefix" type="string">
      A string prefix to match document IDs for deletion. All documents with IDs starting with this prefix will be deleted.
    </ResponseField>

    <ResponseField name="filter" type="string">
      A [filter](/search/features/filtering) to delete documents based on content fields.

      <Warning>
        Deleting document with filter is a O(N) operation that performs a full
        scan. Therefore, it might be slow for large indexes.
      </Warning>
    </ResponseField>
  </Expandable>
</ResponseField>

### Response

<ResponseField name="Response" type="int" required>
  The number of documents that were successfully deleted.
</ResponseField>

<RequestExample>
  ```typescript Delete by IDs Array theme={"system"}
  index.delete(ids=["star-wars", "inception"]);
  ```

  ```typescript Delete by Prefix theme={"system"}
  index.delete(prefix="star-");
  ```

  ```typescript Delete with Filter theme={"system"}
  index.delete(filter="age > 30");
  ```
</RequestExample>
