Getting started overview

To begin using Elasticsearch, developers typically choose between a self-managed, open-source installation or a managed service through Elastic Cloud. Both options allow access to Elasticsearch's capabilities for search and analytics, but they differ in setup complexity and maintenance requirements. For rapid deployment and reduced operational overhead, Elastic Cloud is often preferred for initial exploration and production workloads.

This guide outlines the process for getting started with Elastic Cloud. The core steps involve creating an Elastic Cloud account, provisioning a deployment, generating API keys, and executing a basic HTTP request to index a document. Understanding the underlying RESTful API is fundamental, as it forms the basis for interaction across all supported client libraries and integrations, as described in the official Elasticsearch REST API reference.

Here’s a quick reference for the initial setup:

Step What to do Where
1. Account Creation Register for an Elastic Cloud account. Elastic Cloud sign-up page
2. Deployment Setup Create a new Elasticsearch deployment. Elastic Cloud Console
3. Credentials Generate an API key or note your username/password. Elastic Cloud Console (Deployment Security settings)
4. Endpoint URL Retrieve your deployment's Elasticsearch endpoint URL. Elastic Cloud Console (Deployment overview)
5. First Request Index a simple document using cURL or a client library. Local terminal or development environment

Create an account and get keys

To access Elasticsearch on Elastic Cloud, you must first create an account. Navigate to the Elastic Cloud homepage and select the option to sign up. Elastic offers a free tier with limited resources, which is suitable for initial testing and development. During the sign-up process, you may be prompted to provide billing information, but you can typically start with the free tier without immediate charges.

Provisioning an Elasticsearch Deployment

After creating your account, log in to the Elastic Cloud console. You will need to create a new deployment. A deployment is a collection of Elastic Stack products (Elasticsearch, Kibana, etc.) configured to work together. When creating a deployment, you can choose:

  • Cloud Provider: Options typically include AWS, GCP, and Azure.
  • Region: Select a geographical region close to your users or applications.
  • Version: Choose the desired version of Elasticsearch.
  • Deployment Template: These templates (e.g., "Development", "Production", "I/O optimized") pre-configure resource allocations (CPU, RAM, storage) and topologies.

Once configured, Elastic Cloud will provision your deployment, which may take several minutes. Upon completion, you will be presented with the deployment details, including the Elasticsearch endpoint URL and initial credentials.

Obtaining API Keys or User Credentials

Security for Elastic Cloud deployments relies on API keys or username/password authentication. For programmatic access, API keys are generally recommended as they offer fine-grained control over permissions and can be revoked easily. To generate an API key:

  1. Navigate to your deployment in the Elastic Cloud console.
  2. Go to the "Security" section, and then "API Keys".
  3. Create a new API key, assigning it appropriate roles (e.g., data_writer for indexing, data_reader for searching).
  4. The API key ID and API key will be displayed. Save these immediately, as the full API key will not be shown again.

Alternatively, the initial deployment setup typically provides a username (e.g., elastic) and a randomly generated password. This password can be reset from the "Security" section if needed. When using username/password, you will typically use HTTP Basic Authentication.

Your first request

With your Elasticsearch endpoint URL and credentials, you can now make your first request. This example demonstrates indexing a single document into an Elasticsearch index named my-first-index using cURL. Ensure you replace <YOUR_ELASTIC_CLOUD_URL>, <YOUR_API_KEY_ID>, and <YOUR_API_KEY> with your actual values.

Using cURL with API Key Authentication

curl -X POST "<YOUR_ELASTIC_CLOUD_URL>/my-first-index/_doc" \ 
  -H "Content-Type: application/json" \ 
  -H "Authorization: ApiKey <YOUR_API_KEY_ID>:<YOUR_API_KEY>" \ 
  -d '{"message": "Hello, Elasticsearch! This is my first document.", "timestamp": "2026-05-28T10:00:00Z"}'

A successful response will look similar to this, indicating the document was created:

{
  "_index" : "my-first-index",
  "_type" : "_doc",
  "_id" : "L7yvFpB_o6_o8o3F0xG9",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 2,
    "failed" : 0
  },
  "_seq_no" : 0,
  "_primary_term" : 1
}

Using cURL with Basic Authentication

If using username/password, the Authorization header changes:

curl -X POST "<YOUR_ELASTIC_CLOUD_URL>/my-first-index/_doc" \ 
  -H "Content-Type: application/json" \ 
  -u "elastic:<YOUR_PASSWORD>" \ 
  -d '{"message": "Hello, Basic Auth Elasticsearch!", "timestamp": "2026-05-28T10:05:00Z"}'

Searching for your first document

To verify the document was indexed, you can perform a simple search:

curl -X GET "<YOUR_ELASTIC_CLOUD_URL>/my-first-index/_search?q=message:Hello" \ 
  -H "Authorization: ApiKey <YOUR_API_KEY_ID>:<YOUR_API_KEY>"

This request searches for documents in my-first-index where the message field contains "Hello". A successful response will include your indexed document within the hits array.

Common next steps

After successfully indexing your first document, consider these common next steps to further your exploration of Elasticsearch:

  1. Install and Connect Kibana: Kibana is the visualization layer of the Elastic Stack. It allows you to explore your data, define dashboards, and manage your Elasticsearch instances. Your Elastic Cloud deployment includes Kibana, accessible via a link in your deployment overview. You can interactively query your data and monitor cluster health.
  2. Use an Official Client Library: While cURL is useful for quick tests, using one of the official Elasticsearch client libraries (Java, Python, JavaScript, etc.) is recommended for application development. These libraries provide idiomatic ways to interact with the API, handle connection management, and simplify query construction.
  3. Define Index Mappings: By default, Elasticsearch dynamically infers the data type for fields when you index a document. For production applications, it's best practice to explicitly define your index mapping (schema) to control how data is stored and indexed. This ensures consistency and optimizes search performance for specific field types, such as keyword for exact matches or text for full-text search.
  4. Learn Basic Query DSL: Elasticsearch uses a powerful JSON-based Query DSL (Domain Specific Language) for complex search queries. Begin by exploring basic queries like match, term, and range queries to understand how to retrieve specific data effectively.
  5. Explore Data Ingestion with Beats or Logstash: For continuous data ingestion from various sources (logs, metrics, network data), explore Elastic Beats (lightweight data shippers) or Logstash (a server-side data processing pipeline). These tools streamline getting diverse data into Elasticsearch.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting tips:

  • Incorrect Endpoint URL: Double-check that the Elasticsearch endpoint URL is correct and includes the proper protocol (https://). The URL is visible on your Elastic Cloud deployment overview.
  • Authentication Errors (401 Unauthorized):
    • API Key: Ensure the API key ID and the API key itself are correctly concatenated with a colon (:) and base64 encoded if not handled automatically by your client. Verify the API key has the necessary permissions (e.g., data_writer).
    • Basic Auth: Confirm the username and password are correct. Remember that the -u flag in cURL handles the base64 encoding for you.
    • Expired Credentials: If using trial credentials, they might have expired.
  • Network Connectivity Issues: Verify that your local machine can reach the Elastic Cloud endpoint. Firewall rules or corporate proxies can block access. You can test basic connectivity using ping or telnet (e.g., telnet <your_cloud_url_hostname> 443).
  • Syntax Errors in JSON Body: Ensure your JSON payload in the -d parameter is valid. Malformed JSON will result in a parsing error from Elasticsearch. Tools like JSON.parse on MDN Web Docs can help validate JSON syntax.
  • Index Not Found (404 Not Found): This typically occurs when you are trying to perform an operation on an index that hasn't been created yet. Indexing a document (as in the first request example) will automatically create the index if it doesn't exist, but some operations (like specific search queries) might assume the index is already present.
  • Read the Error Message: Elasticsearch provides descriptive error messages in its API responses. Carefully review the error and reason fields in the JSON response for clues about what went wrong.