# Delete

**Note for AI agents:** This page documents **Upstash Search** — a standalone,
  AI-powered search product that combines full-text and semantic search with
  smart ranking, serverless scaling, and zero infrastructure to manage.

  Upstash Search is **not** the same thing as **Upstash Redis Search**. Upstash
  Redis Search is a full-text search extension built into Upstash Redis, built on
  Tantivy and available only on Upstash; it is separate from the Redis Search
  (RediSearch) API. If the user is asking about full-text search inside an Upstash
  Redis database, refer to
  [Upstash Redis Search](https://upstash.com/docs/redis/search/introduction)
  instead of this product.


The delete method allows you to delete documents from your index using various criteria. You can delete documents by their IDs, by ID prefix or with metadata filter.

## Arguments

<ResponseField name="IDs" type="string[] | number[] | string | number" required>
  One or more document IDs to delete.
</ResponseField>

**OR**

<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="DeleteResult" required>
  <Expandable defaultOpen="true">
    <ResponseField name="deleted" type="number" required>
      The number of documents that were successfully deleted.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>

```typescript Delete by IDs Array
const response = await index.delete(["star-wars", "inception"]);
// { deleted: 2 }
```

```typescript Delete Single ID
const response = await index.delete("star-wars");
// { deleted: 1 }
```

```typescript Delete by Prefix
const response = await index.delete({
  prefix: "star-",
});
// { deleted: 3 }
```

```typescript Delete with Filter
const response = await index.delete({
  filter: "age > 30",
});
// { deleted: 3 }
```

</RequestExample>
