Elasticsearch is a JSON based noSQL document database and provides search functionality for a diverse range of applications like managing data for customer behaviour tracking, system monitoring in IT industry, etc. Today we will be looking at how to create index in elasticsearch.
An index is a collection of documents in Elasticsearch and a Shard is a subset of the documents. Hashing algorithm is used by the Elasticsearch and is used to distribute data across the nodes in elastic search. It becomes evident that when working with elasticsearch there is always a need to create a new index.
Create Index in Elasticsearch:
Index can be created easily with the following command:
curl -XPUT http://localhost:9200/new_index_name_here
Execute the above command in the Linux shell terminal and the new index will be created in Elasticsearch and an acknowledgement message like the below image will be displayed:
List all Indices in Elasticsearch:
In order to check whether the index is created properly in Elasticsearch, you can use the following command:
curl -XGET http://localhost:9200/_cat/indices
This will list all the indices present in the elasticsearch and will be displayed like the following: