---
type: api
title: Delete ES|QL data sources
description: Deletes one or more data sources used in ES|QL data federation.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-esql-delete-data-source
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-esql-delete-data-source
products:
  - Elasticsearch
---

# Delete ES|QL data sources

Availability: Experimental since 9.5

## Paths

- `DELETE` `/_query/data_source/{name}`

#### Path parameters

- `name` (union string | string[]) — required
  A comma-separated list of data source names to delete.

## Description

Deletes one or more data sources used in ES|QL data federation.
Fails with `409` if any dataset references one of the named data sources;
delete the dependent datasets first.

[ES|QL Data Federation](https://www.elastic.co/docs/reference/query-languages/esql/esql-data-federation)

## Required authorization

- Cluster privileges: `manage`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `master_timeout` (string · default: 30s) — optional
  Period to wait for a connection to the master node.
- `timeout` (string · default: 30s) — optional
  The time to wait for the request to be completed.

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code examples

#### Console

```console
DELETE /_query/data_source/prod_s3_logs
```

#### JavaScript

```javascript
const response = await client.esql.deleteDataSource({
  name: "prod_s3_logs",
});
```

#### Python

```python
resp = client.esql.delete_data_source(
    name="prod_s3_logs",
)
```

#### curl

```curl
curl -X DELETE "$ELASTICSEARCH_URL/_query/data_source/prod_s3_logs" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.esql().deleteDataSource(d -> d
    .name("prod_s3_logs")
);
```

#### PHP

```php
$resp = $client->esql()->deleteDataSource([
    "name" => "prod_s3_logs",
]);
```

#### Ruby

```ruby
response = client.esql.delete_data_source(
  name: "prod_s3_logs"
)
```

## Response examples

#### Data source deleted

The data source configuration was deleted successfully.

```json
{
  "acknowledged": true
}
```

