Introduction to OpenSearch
Tags: opensource, opensearch, elasticsearch, database
Published: 2022-01-27 14:07:36

_OpenSearch is a community-driven and truly open source search and analytics suite. Read on for a high-level look at its capabilities._

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](https://lucene.apache.org/) 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](https://opensearch.org/docs/latest/opensearch/cluster/) 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](https://developer.aiven.io/docs/products/opensearch/concepts/indices.html) 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](https://curl.haxx.se/) 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](https://opensearch.org/docs/latest/opensearch/index/).

```
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](https://developer.aiven.io/docs/products/opensearch/concepts/aggregations) or the even more detailed one from the [OpenSearch project site](https://opensearch.org/docs/latest/opensearch/aggregations/). 

## 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](https://console.aiven.io/login) 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](https://developer.aiven.io/docs/products/opensearch/howto/opensearch-with-curl.html). If you’re hungry (pun intended) for test data, we’ve picked a [sample recipe dataset](https://developer.aiven.io/docs/products/opensearch/howto/sample-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. 

- Check out our documentation for [Aiven for OpenSearch](https://developer.aiven.io/docs/products/opensearch/index) on the Developer Portal
- Get started with OpenSearch with our [sample dataset](https://developer.aiven.io/docs/products/opensearch/howto/sample-dataset) 
- If you’re an Aiven for Elasticsearch user and are interested in moving to OpenSearch, check out [Migrate Elasticsearch data to Aiven for OpenSearch](https://developer.aiven.io/docs/products/opensearch/howto/migrating_elasticsearch_data_to_aiven) for help in migrating your data 
- Find out how to get started with [OpenSearch using NodeJS](https://aiven.io/blog/start-using-opensearch-with-nodejs) on the Aiven blog
- [Aiven for OpenSearch repositories on GitHub ](https://github.com/orgs/aiven/repositories?q=opensearch&type=all&language=&sort=)

And, finally, sign up for a free trial to start using [Aiven for OpenSearch](https://aiven.io/opensearch) and follow us on [Twitter](https://twitter.com/aiven_io) to stay up-to-date with product and feature-related news.