This project demonstrates various OpenSearch search capabilities through a web application built with Cloudscape React and AWS services.
The application provides examples of different search functionalities using Amazon OpenSearch Service, including:
- Keyword Search
- Prefix Match
- Multi Match
- Fuzzy Search
- Minimum Should Match
- Wildcard Match
- Range Filter
- Compound Queries
- Aggregations
- Semantic Search (Disk vs In-Memory modes)
- Hybrid Search (Disk vs In-Memory modes)
- Document Indexing
The application is built using:
- Frontend: React with Cloudscape Design System
- Backend: AWS Lambda functions / API Gateway
- Search: Amazon OpenSearch Service
- Infrastructure: AWS CDK
- Hosting: AWS App Runner
- Authentication: Amazon Cognito
- Node.js 16 or later
- Python 3.10 or later
- AWS CDK v2.91.0
- AWS CLI configured with appropriate credentials
-
Search for Cloudshell service on the AWS Console and follow the steps below to clone the github repository
-
Clone the sample-for-amazon-opensearch-tutorials-101 repository using the below command:
git clone https://github.com/aws-samples/sample-for-amazon-opensearch-tutorials-101.git
- Head on to the sample-for-amazon-opensearch-tutorials-101 folder using the below command
cd sample-for-amazon-opensearch-tutorials-101

- Deploy the infrastructure:
sh installer.sh
Note: triggering builder.sh directly runs the script in Cloudshell which could terminate due to inactivity. We recommend running installer.sh which triggers a codebuild job.
-
Press Enter to confirm deployment
-
The deployment takes 30 minutes to create all resources. You can track its progress on Cloudformation
-
Get started by first creating your account on the Opensearch tutorial Application
-
To test out Keyword search functionality, first index some products on the Opensearch tutorial application. Every feature is also accompanied by a guide, best practices and links to the Opensearch documentation. You could also index a custom product.
Note: The builder script will:
- Deploy the Lambda Layer Stack
- Build and deploy the OpenSearch Proxy Stack
- Build and deploy the UI container
- Deploy the App Runner hosting stack
The application supports three environments:
- dev
- qa
- sandbox
Configuration for each environment is managed in cdk.json
.
Delete all the deployed resources
cdk destroy
.
├── app.py # CDK app entry point
├── artifacts/
│ ├── index_lambda/ # Document indexing function
│ ├── opensearch-app-ui/ # React frontend application
│ └── search_lambda/ # Search functionality
├── builder.sh # Deployment automation script
├── search_tutorials/ # CDK infrastructure stacks
└── requirements.txt # Python dependencies
The application implements several security measures:
- Private VPC for OpenSearch domain
- AWS IAM roles and policies for service access
- HTTPS enforcement for all API endpoints
- Cognito user authentication
The UI is located in artifacts/opensearch-app-ui/
and can be run locally:
cd artifacts/opensearch-app-ui
npm install
npm run dev
Infrastructure is defined using AWS CDK in the search_tutorials/
directory:
-
lambda_layer_stack.py
: Lambda layers for dependencies -
opensearch_proxy_stack.py
: OpenSearch domain and Lambda functions -
apprunner_hosting_stack.py
: UI hosting configuration -
DeepWiki Docs : https://deepwiki.com/aws-samples/sample-for-amazon-opensearch-tutorials-101