---
type: api
title: Clear a scrolling search
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-clear-scroll
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-clear-scroll
products:
  - Elasticsearch
---

# Clear a scrolling search


Availability:

## Paths

- `DELETE` `/_search/scroll/{scroll_id}`
- `DELETE` `/_search/scroll`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#bearerauth)

#### Path Parameters

- `scroll_id` (union ScrollId | [] ScrollId) — optional, leave it out to use `/_search/scroll` — deprecated
  A comma-separated list of scroll IDs to clear.
To clear all scroll IDs, use `_all`.
IMPORTANT: Scroll IDs can be long. It is recommended to specify scroll IDs in the request body parameter.

## Description

Clear the search context and results for a scrolling search.

[About paginating search results](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/paginate-search-results#scroll-search-results)

## Request Body

`application/json`

- `scroll_id` (ScrollIds) — optional
  The scroll IDs to clear.
To clear all scroll IDs, use `_all`.

## Response

`application/json`

- `succeeded` (boolean)
  If `true`, the request succeeded.
This does not indicate whether any scrolling search requests were cleared.
- `num_freed` (number)
  The number of scrolling search requests cleared.
## Code Examples

#### Console

```console
DELETE /_search/scroll
{
  "scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="
}
```

#### JavaScript

```javascript
const response = await client.clearScroll({
  scroll_id: "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
});
```

#### Python

```python
resp = client.clear_scroll(
    scroll_id="DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
)
```

#### curl

```curl
curl -X DELETE "$ELASTICSEARCH_URL/_search/scroll" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="
  }'
```

#### Java

```java
client.clearScroll(c -> c
    .scrollId("DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==")
);
```

#### C#

```c#
var response = await client
    .ClearScrollAsync(d1 => d1
        .ScrollId(new[] { "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" })
    );
```

#### PHP

```php
$resp = $client->clearScroll([
    "body" => [
        "scroll_id" => "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
    ],
]);
```

#### Ruby

```ruby
response = client.clear_scroll(
  body: {
    "scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="
  }
)
```

