Type to search.

Securing HTTP client applications

ECH

Elastic Cloud Hosted lets you manage and configure one or more deployments of the versioned Elastic Stack, hosted on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

ECK

Elastic Cloud on Kubernetes extends Kubernetes orchestration capabilities to allow you to deploy and manage components of the Elastic Stack.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

ECE

Elastic Cloud Enterprise is a self-managed orchestration platform for deploying and managing the Elastic Stack at scale.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Self-managed

Self-managed deployments are Elastic Stack deployments managed without the assistance of an orchestrator.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

When connecting client applications to Elasticsearch, use these best practices:

  • Always use HTTPS for all connections
  • Validate server certificates to prevent man-in-the-middle attacks
  • Use API keys or token-based authentication rather than basic auth where possible
  • Implement appropriate connection pooling and retry mechanisms
  • Consider mutual TLS for high-security environments

The Elasticsearch security features work with standard HTTP basic authentication headers to authenticate users. Since Elasticsearch is stateless, this header must be sent with every request:

Shell
Authorization: Basic <TOKEN>
  1. The <TOKEN> is computed as base64(USERNAME:PASSWORD)

Alternatively, you can use token-based authentication services.

This example uses curl without basic auth to create an index:

Shell
curl -XPUT 'localhost:9200/idx'
JavaScript
{
  "error":  "AuthenticationException[Missing authentication token]",
  "status": 401
}

Since no user is associated with the request above, an authentication error is returned. Now we’ll use curl with basic auth to create an index as the rdeniro user:

Shell
curl --user rdeniro:taxidriver -XPUT 'localhost:9200/idx'
JavaScript
{
  "acknowledged": true
}

Some APIs support secondary authorization headers for situations where you want tasks to run with a different set of credentials. For example, you can send the following header in addition to the basic authentication header:

Shell
es-secondary-authorization: Basic <TOKEN>
  1. The <TOKEN> is computed as base64(USERNAME:PASSWORD)

The es-secondary-authorization header has the same syntax as the Authorization header. It therefore also supports the use of token-based authentication services. For example:

Shell
es-secondary-authorization: ApiKey <TOKEN>
  1. The <TOKEN> is computed as base64(API key ID:API key)

For more information about using security features with the language specific clients, refer to: