Getting started with OpenSearch

satish1v
2 min readJun 28, 2021

--

Open search is a drop-in replacement for elastic search. Open-sourced by AWS and recently got an RC.

Getting Started

To start, let’s use the official Docker compose file. If you are new to Docker, then go to the folder where you have downloaded the file and start the services using

docker-compose up

You can read more about the docker-compose here.

Troubleshooting:

Open search needs more virtual memory than allocated by the default docker-machine. So you can increase to a higher number using the following commands in windows

Once it is done then you can browse for the dashboard at http://localhost:5601/ and login with the default user name/password (admin/admin)

Basic CRUD operation

OpenSearch is a document database under the hood, and to start with, I will show the essential document operation is inserting, Reading, updating, and delete the operation.

Let's open up http://localhost:5601/app/dev_tools#/console for playing around.

Open Search works on Index and Index provides a place where we can group the documents. So you can loosely associate this with tables for this blog post, But as we delve deep into the concepts Index this may vary.

create an Index, We can use the following

PUT place

This will create a new index to the elastic search Database.

Insert

To insert a Data into the Places index, You can use Post or Put

PUT place/_doc/1
{
“name”:”london”
}

Post can be used when you want elastic to autogenerate ID.

Read :

To get the inserted Data, you can use Get

GET place/_doc/1

Update

Update follows a different semantic than other constructs.

You need to use the URL to mention the intention that you are planning to update the doc inside the index of Place

Delete

You can delete the document using a simple Delete HTTP verb

DELETE place/_doc/1

--

--