Jan 27, 2022
Introduction to OpenSearch®
OpenSearch is a community-driven and truly open source search and analytics suite. Read on for a high-level look at its capabilities.
Last year in September we introduced Aiven for OpenSearch. In this post, we’re going to provide a high-level overview of OpenSearch components and use cases that would be fitting for this open source search and analytics engine. Let’s dive right into it!
What is OpenSearch?
In short, OpenSearch is an open source alternative to Elasticsearch. It is a search and analytics suite that includes a search engine daemon, OpenSearch, NoSQL database, and a visualization interface. It offers a distributed, full-text search engine based on Apache Lucene with a RESTful API interface and support for JSON documents.
Let’s look at some of OpenSearch's components and concepts in more detail.
Clusters and nodes
OpenSearch is a distributed search and analytics engine, which means that you interact with its highly scalable clusters. Each cluster consists of one or more nodes that store your data and process search requests.
As mentioned above, the clusters are scalable. You can run a single node cluster, like your laptop, or multiple powerful machines. As your cluster grows, you can divide responsibilities across those machines. You can also tailor different servers to different types of tasks. Those machines that have fast disks could index and search data, while a server with a smaller disk, but high CPU, can be responsible for cluster’s state management.
If you want more details, you can check out the Cluster formation article on the Open Search project site.
Indices
Much like databases and tables in relational databases, OpenSearch uses indices to organize data. The data is distributed within your cluster by mapping each index to a primary shard, which is copied to one or more replica shards. This protects your data from hardware failure and provides additional capacity for read requests.
The Indices article on the Aiven Developer Portal provides a deeper dive into the topic of indices and shards.
REST API
For communication, OpenSearch relies on the REST API. You can use any programming language or client like cURL to send HTTPS requests.
Below is an example of adding a JSON document to an OpenSearch index by sending an HTTPS request, taken from the official OpenSearch project site.
PUT https://<host>:<port>/<index-name>/_doc/<document-id> { "title": "The Wind Rises", "release_date": "2013-07-20" }
To run a search for the document:
GET https://<host>:<port>/<index-name>/_search?q=wind
To delete the document:
DELETE https://<host>:<port>/<index-name>/_doc/<document-id>
Aggregations
One of the great things about OpenSearch is its powerful analytics engine. The engine can perform calculations, analyze your data, and extract statistics from it. This can come in handy when you try to analyze data in real-time and visualize it in OpenSearch Dashboards.
If you’re curious to learn more about OpenSearch aggregations, check out our article about Aggregations on the Developer Portal or the even more detailed one from the OpenSearch project site.
What are the primary use cases for OpenSearch?
With OpenSearch, you can easily ingest, search, aggregate, view, and analyze data. These capabilities are popular for use cases such as log analytics, real-time application monitoring, clickstream analytics, search backend, and more.
How to get started with OpenSearch?
Great news! You can get started with OpenSearch right in the Aiven Console and here’s how:
- Choose the OpenSearch version, your cloud provider and location to deploy to, then choose which plan to use
- Give your service a name
- Click “Create Service”, and your shiny new OpenSearch database will start building.
- While it does that, you can already visit the service overview page to see the details of the service.
To test your service and play around with your own data, you can start by connecting with cURL. If you’re hungry (pun intended) for test data, we’ve picked a sample recipe dataset that you can use to explore OpenSearch.
Wrapping up
If you’re looking for a powerful open source search and analytics engine, OpenSearch has pretty much everything you need to search and manage your data.
- Find out how to get started with OpenSearch using Python and NodeJS on the Aiven blog
- Check out our documentation for Aiven for OpenSearch on the Developer Portal
If you’re an Aiven for Elasticsearch user and are interested in moving to OpenSearch, check out Migrate Elasticsearch data to Aiven for OpenSearch from our documentation for assistance. You can sign up for a free trial to start using Aiven for OpenSearch, and follow us on Twitter to stay up-to-date with product and feature-related news.
Stay updated with Aiven
Subscribe for the latest news and insights on open source, Aiven offerings, and more.