﻿---
title: Sending data to Elasticsearch Serverless
description: When you use Elasticsearch on Elastic Cloud Serverless you don’t need to worry about managing the infrastructure that keeps Elasticsearch distributed...
url: https://www.elastic.co/elastic/docs-builder/docs/2865/reference/logstash/connecting-to-serverless
products:
  - Logstash
---

# Sending data to Elasticsearch Serverless
When you use Elasticsearch on Elastic Cloud Serverless you don’t need to worry about managing the infrastructure that keeps Elasticsearch distributed and available. These resources are automated on the serverless platform and are designed to scale up and down with your workload.
<admonition title="Logstash to Elastic Cloud Serverless">
  You’ll use the Logstash [Elasticsearch output plugin](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-outputs-elasticsearch) to send data to Elastic Cloud Serverless.
  Note these differences between Elasticsearch Serverless and both Elastic Cloud Hosted and self-managed Elasticsearch:
  - Use [**API keys**](/elastic/docs-builder/docs/2865/reference/logstash/secure-connection#ls-api-keys) to access Elastic Cloud Serverless from Logstash as it does not support native user authentication.
    Any user-based security settings in your [Elasticsearch output plugin](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-outputs-elasticsearch) configuration are ignored and may cause errors.
  - Elastic Cloud Serverless uses **data streams** and [data lifecycle management (DLM)](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/manage-data/lifecycle/data-stream) instead of index lifecycle management (ILM). Any ILM settings in your [Elasticsearch output plugin](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-outputs-elasticsearch) configuration are ignored and may cause errors.
  - **Logstash monitoring** is available through the [Logstash Integration](https://github.com/elastic/integrations/blob/main/packages/logstash/_dev/build/docs/README.md) in [Elastic Observability](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/solutions/observability) on Elastic Cloud Serverless.
  **Known issue for Logstash to Elasticsearch Serverless.**
  The logstash-output-elasticsearch `hosts` setting defaults to port :9200.
  Set the value to port :443 instead.
</admonition>


## Communication between Logstash and Elasticsearch Serverless

[Elasticsearch Serverless](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/solutions/elasticsearch-solution-project/get-started) simplifies safe, secure communication between Logstash and Elasticsearch.
To send data to a Serverless project, configure the Logstash Elasticsearch output plugin to connect using the project's **Elasticsearch endpoint URL** and an **API key**.
```ruby
output {elasticsearch { hosts => "ELASTICSEARCH_ENDPOINT_URL" api_key => "<api key>" } }
```

The value of the [`api_key` option](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-outputs-elasticsearch#plugins-outputs-elasticsearch-api_key) is in the format `id:api_key`, where `id` and `api_key` are the values returned by the [Create API key API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-create-api-key).

### Elasticsearch endpoint URL

1. Log in to [Elastic Cloud](https://cloud.elastic.co/).
2. Find your **Elasticsearch endpoint URL**:
   Select **Manage** next to your project. Then find the Elasticsearch endpoint under **Application endpoints, cluster and component IDs**.
   Alternatively, open your project, select the help icon, then select **Connection details**.


### API key

Create an **API key** with the appropriate privileges. Refer to [Create API key](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/solutions/elasticsearch-solution-project/search-connection-details#create-an-api-key-serverless) for detailed steps. For information on the required privileges, refer to [Grant access using API keys](/elastic/docs-builder/docs/2865/reference/logstash/secure-connection#ls-create-api-key).
When you create an API key for Logstash, select **Logstash** from the **API key format** dropdown.
This option formats the API key in the correct `id:api_key` format required by Logstash.
![API key format dropdown set to Logstash:](https://www.elastic.co/elastic/docs-builder/docs/2865/reference/logstash/images/logstash_api_key_format.png)

<note>
  The [Elasticsearch input](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-inputs-elasticsearch#plugins-inputs-elasticsearch-api_key),
  [Elasticsearch output](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-outputs-elasticsearch#plugins-outputs-elasticsearch-api_key), and
  [Elasticsearch filter](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-filters-elasticsearch#plugins-filters-elasticsearch-api_key) plugins, as well as the
  [Elastic_integration filter](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/2865/lsr/plugins-filters-elastic_integration#plugins-filters-elastic_integration-api_key) plugin, all support the `api_key` option in their configurations.
</note>


## Using Logstash Central Pipeline Management with Elasticsearch Serverless

To set up Central Pipeline management in Elasticsearch Serverless, update the `logstash.yml` config file to provide the API key and set the value for `xpack.management.elasticsearch.hosts` to your Elasticsearch endpoint URL.
```ruby
xpack.management.elasticsearch.hosts: "ELASTICSEARCH_ENDPOINT_URL" 
xpack.management.elasticsearch.api_key: "<api_key>"
```