Elasticsearch Tutorial : A Complete guide for the beginners

Thursday, December 26, 2019

Elasticsearch Tutorial : A Complete guide for the beginners


Elasticsearch is a highly scalable, open-source, full-text search and analytics engine. It lets you store, search, and analyse large volumes of data quickly and in near real time. It is generally used as the underlying engine that powers applications with complex search requirements. Elasticsearch builds a distributed system on top of Apache Lucene for indexing and automatic type guessing, and exposes Lucene's features through a JSON-based REST API.

Elasticsearch search and analytics engine logo
Elasticsearch

The below topics are covered in this blog -

1) Overview of Elasticsearch
2) SQL vs NoSQL
3) Relational vs non-relational databases
4) Scale up vs scale out
5) What is Elasticsearch?
6) How does Elasticsearch work?
7) Real-time example — Case 1
8) Real-time example — Case 2
9) Companies using Elasticsearch
10) Installing Elasticsearch
11) Bulk indexing from MongoDB to Elasticsearch
12) Elasticsearch with Node.js

1. Overview of Elasticsearch

Developed by: Elastic NV, first released on 8 February 2010.

Features:

  • Data storage and a document store for unstructured data
  • Flexible data types and full-text search
  • Field- and document-level APIs
  • Cluster indices, data snapshots, and rollup indices
  • Elasticsearch SQL and role-based access control

2. SQL vs NoSQL

Before going deeper into Elasticsearch, it helps to understand SQL and NoSQL, because the distinction is central to how Elasticsearch scales.

  • SQL databases scale vertically — to grow, you increase the capacity (CPU, RAM) of a single server.
  • NoSQL databases scale horizontally — to grow, you add more servers.

3. Relational vs Non-Relational Databases

In a relational (scale-up) database you have primary keys, secondary keys, and foreign keys, along with joins — left outer join, right outer join, full join, and so on. As the data grows on a single server, you increase that server's RAM and CPU.

In a non-relational (scale-out) database there is no join concept. Instead of increasing the power of one server, you add more servers to share the load.

4. Scale Up vs Scale Out

Why cover all this in a post about Elasticsearch? Because Elasticsearch is a NoSQL, scale-out database, and understanding scale-out is what makes the rest of it make sense. Rather than growing one machine, Elasticsearch distributes data and load across many nodes.

5. What is Elasticsearch?

Elasticsearch is an open-source, RESTful, distributed search and analytics engine built on Apache Lucene. Since its release it has become one of the most popular search engines, commonly used for log analytics, full-text search, security intelligence, business analytics, and operational intelligence.

6. How Does Elasticsearch Work?

Raw data flows into Elasticsearch from a variety of sources — logs, system metrics, web applications, and more. During ingestion, this raw data is parsed, normalised, and enriched before being indexed. Once indexed, you can run complex queries against it and use aggregations to retrieve rich summaries. From Kibana, you can then build visualisations, share dashboards, and manage the Elastic Stack.

7. Real-Time Example — Case 1

Consider the basic architecture of a web application dealing with a huge amount of data. The frontend is a web browser. When a user searches, if a large volume of data sits in a traditional database, it becomes difficult to return relevant results quickly. This is exactly where Elasticsearch comes in — it sits alongside the primary database and serves fast search results.

Web application architecture using Elasticsearch for search
Real-Time Example — Case 1

8. Real-Time Example — Case 2

In the second scenario, when you have a large amount of data to work with and surface to the frontend, Elasticsearch again fits well. And once your data is in Elasticsearch, you can visualise it through Kibana as a pie chart, bar chart, table, and more.

Elasticsearch with Kibana visualisation architecture
Real-Time Example — Case 2

These are just two examples. There are countless reasons and challenges you will face when dealing with big data — and those help you decide when and where Elasticsearch and Kibana fit into the picture.

9. Companies Using Elasticsearch

Many well-known companies use Elasticsearch, Kibana, Logstash, and Filebeat, including Cisco, SAP, IBM, Citrix, Meta (Facebook), LinkedIn, Microsoft, Red Hat, Adobe, EA, Bosch, eBay, Flipkart, and others.

Is it free? Yes — Elasticsearch is free for many features and services under its open-source and free tiers, with paid options for advanced capabilities.

10. Installing Elasticsearch

Download Elasticsearch from the official Elastic site. Match the version to your Kibana and Logstash versions:

https://www.elastic.co/downloads/elasticsearch

11. Bulk Indexing from MongoDB to Elasticsearch

This section indexes bulk data from MongoDB into Elasticsearch. Clone the project:

git clone https://bitbucket.org/atique1224/youtube_elasticsearch_indexing_tutorial.git

Reference tools: Node.js, Visual Studio Code, MongoDB, and Robo 3T.

12. Elasticsearch with Node.js — Aggregation and CRUD

This section covers using Elasticsearch from Node.js: aggregations and the GET, POST, PUT, and DELETE methods. Clone the project:

git clone https://bitbucket.org/atique1224/youtube_elasticsearch_with_node_js_tutorial.git

About the Author
Atique Ahmed — Principal AI Architect. 7x Microsoft MVP and Guinness World Record holder for Programming Excellence. Founder of Codez Tech.
Portfolio  |  LinkedIn  |  GitHub

3 comments :

Pigiga said...

What I love about MagazineWrites
is its commitment to providing thoughtful, well-written content. Each article engages the reader with interesting perspectives, clear explanations, and fresh ideas, making it a trusted source for anyone interested in culture, trends, or social commentary.

Pigiga said...

Those who enjoy exploring Greek culture, global trends, and technological innovations will appreciate GreeceMagazine, which consistently delivers insightful and well-written articles, providing readers with both engaging content and a clear understanding of the broader world context.

Pigiga said...

For readers who want to manage technology efficiently, NeedTechhelp provides tutorials, guides, and troubleshooting tips that are clear, practical, and easy to follow, making it a trusted resource for resolving software, device, and internet issues while staying informed.