Hey Folks, Today, we are going to explore about basics of ElasticSearch. From the documentation, its definition is:
Elasticsearch is a highly scalable open-source full-text search and analytics engine. It allows you to store, search, and analyze big volumes of data quickly and in near real time.
It is a real-time distributed search and analytics engine based on top of Apache Lucene. It is used for full-text search, structured search and analytics. Lucene is a full-text search library in java. The elastic search uses indexing and searching capabilities of Lucene and hides the complexities behind a simple RESTful API.
Let’s get familiar with basics key terminology of Elastic Search,
Node: A node is a single server that is part of your cluster, stores your data and participates in the cluster indexing and search capabilities.
Cluster: A cluster is a group of nodes(servers) that holds your entire data and provides indexing and search capabilities across all nodes.
Index: A index is a collection of documents that have somewhat similar characteristics i.e library index can have data of different books
Type: A type is a logical category/partition of your index. It is defined for documents that have a set of common fields. It has been removed after version 7.0 of elasticsearch.
Shard: A shard is basically a Lucene index. It contains the various documents and various data structure that help in searching. Lucene is a full-text library which helps easy searching.
Let’s get started with the installation
1) Download elasticsearch from here
2) Extract the downloaded tar file
3) Run the elastic search
To check elastic search has started successfully, By default, it runs in 9200 port. Hit localhost:9200 in the browser, It will return following json response.
Let’s see the health of our cluster. To check the status of health run the following command on the browser. It will return status either green, red or yellow.
To see the number of nodes is in our cluster,
To see the number of indices is in our cluster,
Let’s create an index library with type book using index API
To delete any index using delete API
To search for data in elastic search, we query the elastic search either using the query parameter or request body.
Now we are familiar with the basic terminology of Elastic Search and basic requests to create and delete an index, search the data etc. We will see the basic crud application using dsl in our next blog. Stay tuned.
Hope you enjoyed the blog. Feel free to suggest or comment.
1 thought on “Introduction to ElasticSearch4 min read”
Comments are closed.