Creates or replaces a named, type-specific data source configuration for ES|QL data federation. Datasets reference data source configurations to access external data. Names must be lowercase and follow index or alias naming rules.
Required authorization
- Cluster privileges:
manage
Query parameters
-
Period to wait for a connection to the master node.
External documentation -
The time to wait for the request to be completed.
External documentation
Body
Required
-
The data source type. Currently,
s3is supported. The value must be lowercase and contain no whitespace. -
A free-text description of the data source.
-
Type-specific connection and authentication settings. For
s3, connection settings includeregionandendpoint. Authentication settings includeauthand the credentials required by the selected authentication method.
PUT
/_query/data_source/{name}
Console
PUT /_query/data_source/prod_s3_logs
{
"type": "s3",
"description": "Production S3 logs bucket",
"settings": {
"region": "us-east-1",
"auth": "static_credentials",
"access_key": "<AWS_ACCESS_KEY_ID>",
"secret_key": "<AWS_SECRET_ACCESS_KEY>"
}
}
resp = client.esql.put_data_source(
name="prod_s3_logs",
type="s3",
description="Production S3 logs bucket",
settings={
"region": "us-east-1",
"auth": "static_credentials",
"access_key": "<AWS_ACCESS_KEY_ID>",
"secret_key": "<AWS_SECRET_ACCESS_KEY>"
},
)
const response = await client.esql.putDataSource({
name: "prod_s3_logs",
type: "s3",
description: "Production S3 logs bucket",
settings: {
region: "us-east-1",
auth: "static_credentials",
access_key: "<AWS_ACCESS_KEY_ID>",
secret_key: "<AWS_SECRET_ACCESS_KEY>",
},
});
response = client.esql.put_data_source(
name: "prod_s3_logs",
body: {
"type": "s3",
"description": "Production S3 logs bucket",
"settings": {
"region": "us-east-1",
"auth": "static_credentials",
"access_key": "<AWS_ACCESS_KEY_ID>",
"secret_key": "<AWS_SECRET_ACCESS_KEY>"
}
}
)
$resp = $client->esql()->putDataSource([
"name" => "prod_s3_logs",
"body" => [
"type" => "s3",
"description" => "Production S3 logs bucket",
"settings" => [
"region" => "us-east-1",
"auth" => "static_credentials",
"access_key" => "<AWS_ACCESS_KEY_ID>",
"secret_key" => "<AWS_SECRET_ACCESS_KEY>",
],
],
]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"type":"s3","description":"Production S3 logs bucket","settings":{"region":"us-east-1","auth":"static_credentials","access_key":"<AWS_ACCESS_KEY_ID>","secret_key":"<AWS_SECRET_ACCESS_KEY>"}}' "$ELASTICSEARCH_URL/_query/data_source/prod_s3_logs"
Request example
Create a data source for production logs stored in Amazon S3. The data source uses static credentials and connects to a bucket in the us-east-1 region.
{
"type": "s3",
"description": "Production S3 logs bucket",
"settings": {
"region": "us-east-1",
"auth": "static_credentials",
"access_key": "<AWS_ACCESS_KEY_ID>",
"secret_key": "<AWS_SECRET_ACCESS_KEY>"
}
}
Response examples (200)
The data source configuration was stored successfully.
{
"acknowledged": true
}