Skip to main content
This tutorial walks through provisioning an Amazon OpenSearch domain (cluster), exploring OpenSearch Dashboards with sample data, and indexing documents using the REST API (curl). It’s designed for a hands-on demo environment — for production deployments, apply stronger availability, security, and sizing choices.

What you’ll do

  • Create an OpenSearch domain in the AWS console
  • Connect to the cluster and OpenSearch Dashboards
  • Add sample data and explore prebuilt dashboards
  • Inspect indices and mappings
  • Query documents in Discover
  • Index documents via the REST API (single PUT and bulk)
  • Clean up the domain to avoid charges

1) Create a domain (cluster)

  1. Open the AWS Console, search for OpenSearch, and open the service page.
  2. Click Create domain. A domain is an OpenSearch cluster with its own instance configuration, storage, and settings.
  3. Choose Standard create to view and control each option (use Easy create only for fast experiments).
  4. Select a template: Production for production workloads or Dev/Test for demos and labs (this guide uses Dev/Test).
Key decisions to make during creation (examples shown for a demo): Example ARN format for IAM principals:
Specify a master username and a strong password (for example admin + a strong password). If fine-grained access control is enabled, OpenSearch Dashboards will require these credentials on login.
A screenshot of the AWS OpenSearch domain creation page showing fine-grained access control enabled with a created master user (username "admin") and a masked password, alongside a Summary panel listing engine version, data node, network and encryption settings.
Using public access makes your cluster reachable from the internet. For production use a VPC and restrictive security groups. Only use public access for short-lived demos.
Other optional settings: SAML or Amazon Cognito authentication, index-level access policies, encryption at rest and in transit, automatic software updates, and advanced cluster parameters. After reviewing settings, create the domain — provisioning typically takes 15–20 minutes.

2) Connect to the cluster

  • When the domain status becomes Active, open domain details to find the Cluster endpoint and the OpenSearch Dashboards URL.
  • Use the cluster endpoint for API calls and the Dashboards URL for the UI.
  • Log in to OpenSearch Dashboards with the master username/password. On first login you’ll be prompted about tenants — the default Global tenant is fine for demos.
Keep your domain endpoint and master credentials private. Consider storing credentials in a secrets manager for repeatable scripts.
A screenshot of the Amazon OpenSearch Service console displaying the "demo" domain details — showing domain status (Active), cluster health (Green), OpenSearch version, and domain endpoint links. The left sidebar shows navigation for Managed clusters, Serverless, and other OpenSearch settings.

3) Add sample data in OpenSearch Dashboards

  1. Open OpenSearch Dashboards and choose Add data.
  2. Select a sample dataset (e.g., Sample eCommerce orders, Sample flight data, or Sample web logs).
  3. Click Add data to install the dataset and then View Data to open its dashboard and indices.
A screenshot of the OpenSearch Dashboards "Add sample data" page showing three sample dataset cards: Sample eCommerce orders, Sample flight data, and Sample web logs, each with preview visualizations and "Add data" buttons. The page header and navigation bar are visible at the top.
After installing the eCommerce dataset, open its dashboard to review metrics and visualizations.
A screenshot of an OpenSearch eCommerce Revenue Dashboard showing key metrics and visualizations. It displays transactions per day (139), average order value (75.25), average items per order (2.163), total revenue (77,583.36) and charts for sales by gender and category.

4) Inspect indices and mappings

  • In OpenSearch Dashboards go to Management → Index Management → Indices to see indices created by the sample dataset.
  • Select an index and open the Mappings tab to view defined fields and types. Reviewing mappings helps you plan queries, aggregations, and future index settings.
A screenshot of the OpenSearch Dashboards index detail view showing the "Mappings" tab for a sample ecommerce index. It lists field mappings in the Visual Editor (e.g., category, currency, customer_first_name, customer_id, geoip.continent_name).

5) Explore documents with Discover

  • Open Discover in Dashboards, choose the correct index pattern for your dataset, and browse documents.
  • Adjust the time range (e.g., last 7 days) and use the left-hand field list to filter or add fields to the display.
  • Example: add filters for manufacturer = Pyramid Distribution and days_of_week = Saturday to show documents matching both conditions.
A screenshot of an OpenSearch Dashboards "Discover" view showing a histogram and filtered e-commerce log results: a left panel of available fields and a right pane listing JSON-like order records with highlighted terms.

6) Indexing documents via the REST API (curl)

AWS documentation includes curl examples for indexing. Replace admin, Password123!, and the domain endpoint with your master username, password, and the domain endpoint URL. Reference:

Index a single document (PUT)

Example PUT request to index one document into an index named movies:
Expected response (trimmed):

Bulk indexing (multiple documents)

  1. Create a local file bulk_movies.json containing newline-delimited JSON (action/metadata line followed by the document source line for each item). Example bulk_movies.json:
Note: The bulk file must use newline-separated JSON lines and should end with a newline.
  1. Call the bulk API:
Expected response (trimmed):

7) Verify documents in Dashboards

  • In OpenSearch Dashboards go to Management → Index Patterns and create an index pattern named movies.
  • Open Discover, select the movies pattern, and search for terms (for example, Downey Jr., Robert) to validate newly indexed documents.

8) Clean up

To avoid ongoing charges, delete the OpenSearch domain when you finish:
  • Open the OpenSearch console → Domains → select your domain → Delete.

This completes the lesson on provisioning an Amazon OpenSearch domain, using OpenSearch Dashboards with sample data, and indexing documents via the REST API.

Watch Video