Introduction, Use Cases, Installation, and Basic Operations of Elasticsearch
This article introduces Elasticsearch as a distributed search and analytics engine, outlines its common application scenarios, provides step‑by‑step installation commands, explains core concepts such as documents and indices, and demonstrates basic indexing, retrieval, bulk processing, and aggregation operations.
1. Introduction Elasticsearch is the core distributed search and analytics engine of the Elastic Stack, offering real‑time search and analysis for structured, unstructured, numeric, and geospatial data, with scalable indexing and querying capabilities.
2. Application scenarios Typical uses include adding a search box to applications or websites, storing and analyzing logs, metrics, and security events, applying machine‑learning for real‑time data modeling, automating business workflows, managing GIS data, and serving as a bioinformatics data store.
3. Installation and deployment Example commands to create a dedicated user, extract the package, set environment variables, verify Java, and start Elasticsearch are shown below:
useradd elasticsearch
su - elasticsearch
rz
tar -xvf elasticsearch-7.5.1-linux-x86_64.tar.gz –C /usr/local
#!/bin/bash
JAVA_HOME=/usr/local/jdk-11
ES_HOME=/usr/local/elasticsearch-7.5.1
PATH=$JAVA_HOME/bin:$ES_HOME/bin:$PATH
java --version
elasticsearch
sh start.sh4. Basic concepts In Elasticsearch, a document is the basic unit of indexing and search, analogous to a database record; a type groups documents similar to a table; an index can contain one or more types, resembling a database.
5. Demo – Creating and retrieving an index Creating an index with a document can be done via:
curl -X POST -H "Content-Type:application/json" "http://127.0.0.1:9200/demo/aa/1?pretty" -d '{"name":"123"}'Retrieving the same document:
curl -X GET "http://127.0.0.1:9200/demo/aa/1?pretty"Bulk API can be used for batch submissions; a typical batch size ranges from 1,000 to 5,000 documents with a payload of 5 MB–15 MB, depending on document size, complexity, indexing load, and cluster resources.
6. Searching data Queries can be built using the Elasticsearch DSL, and results can be filtered with various conditions.
7. Aggregation analysis Elasticsearch supports powerful aggregation features for summarizing and analyzing data trends and patterns.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.