All questions
Showing of 49What is Elasticsearch and what are its main use cases?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Elasticsearch is a distributed search and analytics engine built on Apache Lucene. It stores data as JSON documents behind a RESTful API, and new data becomes searchable in near real time, within about one second. It scales horizontally by adding nodes, and it keeps copies of the data on several nodes for reliability.
Its main use cases are:
- Full-text search on websites, documents and e-commerce products.
- Log analytics on application, system and security logs, often with the ELK stack of Elasticsearch, Logstash and Kibana.
- Real-time analytics, such as business metrics and application performance monitoring.
- Data aggregation for complex analysis and reporting.
- Geospatial search and analytics by location.
You search and analyze the data with the Query DSL, a JSON-based query language.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the basic architecture of Elasticsearch.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Elasticsearch stores data in indices, splits each index into shards, and spreads the shards over the nodes of a cluster. Its building blocks are:
- A node is a single running instance of Elasticsearch.
- A cluster is a collection of nodes that work together.
- An index is a collection of documents with similar characteristics. In relational terms it is closer to a table than to a database.
- A document is the basic unit of information, stored as JSON.
- A shard is a subset of an index's data. Elasticsearch distributes the shards across the nodes.
- A replica is a copy of a primary shard. It adds redundancy and also serves searches, which raises search throughput.
A replica never sits on the same node as its primary. In the layout below, Index A has two primary shards and Index B has one, and every primary has a replica on another node. So losing any one node loses no data.
Cluster
├── Node 1
│ ├── Index A (Primary Shard 0)
│ └── Index A (Replica Shard 1)
├── Node 2
│ ├── Index A (Primary Shard 1)
│ └── Index B (Primary Shard 0)
└── Node 3
├── Index A (Replica Shard 0)
└── Index B (Replica Shard 0)
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between Elasticsearch and traditional relational databases?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Elasticsearch is built to search and analyze data across many machines, while a relational database stores records and changes them safely in transactions. Elasticsearch keeps denormalized JSON documents spread over nodes. A relational database keeps normalized rows in tables and joins them at query time.
| Elasticsearch | Relational database | |
|---|---|---|
| Data model | Document-oriented JSON | Tables with rows and columns |
| Schema | Flexible | Fixed |
| Scaling | Horizontal, by adding nodes | Mostly vertical |
| Guarantees | Near real-time search | ACID transactions |
| Relationships | Denormalized data | Normalized data with JOINs |
| Interface | RESTful API | SQL queries |
| Workload | Optimized for read-heavy search | Balanced reads and writes |
Elasticsearch is the better fit for search, analytics and unstructured data. A relational database is the better fit for transactional work that needs ACID properties, such as orders and payments. Many systems use both. The database stays the source of truth, and Elasticsearch holds a copy of the data for search.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you perform CRUD operations on documents?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
You perform CRUD on Elasticsearch documents with the document APIs. Each operation is one HTTP request to a path made of the index name and the document ID.
To create a document, or replace it if the ID exists, send PUT with the JSON body. This is called indexing a document.
PUT /users/_doc/1
{
"name": "John Doe",
"email": "john@example.com",
"age": 30
}
To read it, send GET to the same path.
GET /users/_doc/1
To change only some fields, use the update API. It merges the partial doc into the stored document.
POST /users/_update/1
{
"doc": {
"age": 31
}
}
To delete it, send DELETE to the same path.
DELETE /users/_doc/1
For many documents, the bulk API sends many operations in one request. The body is newline-delimited JSON, with an action line before each document. Bulk requests are much faster than one request per document, which matters for large loads.
POST /_bulk
{"index": {"_index": "users", "_id": "1"}}
{"name": "Alice", "age": 25}
{"index": {"_index": "users", "_id": "2"}}
{"name": "Bob", "age": 30}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between index and create operations?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The index operation writes a document whether or not its ID already exists, while the create operation writes it only if the ID is new.
- Index,
PUT /index/_doc/id, creates a new document or replaces the entire existing one. Each replace increments the document's_version. - Create,
PUT /index/_create/id, only creates a new document. If a document with the same ID exists, it fails with a409 Conflicterror. The index API gives the same check withop_type=create.
Use create when a duplicate ID would be a bug, such as writing events that must be stored once. Use index when the latest version should win.
# Index - will replace if exists
PUT /users/_doc/1
{"name": "John", "age": 30}
# Create - will fail if ID 1 exists
PUT /users/_create/1
{"name": "Jane", "age": 25}
Run in this order, the second request fails, because the first one already wrote ID 1.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the Query DSL and its main components.
What is the difference between match and term queries?
What is mapping in Elasticsearch and why is it important?
What are the main field data types in Elasticsearch?
What is the difference between text and keyword field types?
What is the analyze API and how is it used?
What is an inverted index and why is it fast?
What is the ELK Stack and what does each part do?
What is the difference between Elasticsearch and OpenSearch?
What are the different types of nodes in Elasticsearch?
Explain sharding in Elasticsearch. What are primary and replica shards?
How does Elasticsearch achieve high availability?
Explain document versioning in Elasticsearch.
What are the different refresh options in Elasticsearch?
How does scoring work in Elasticsearch?
What is the difference between query then fetch and DFS query then fetch?
What are compound queries in Elasticsearch?
Explain dynamic mapping in Elasticsearch.
What are analyzers and how do they work?
How would you create a custom analyzer?
What are aggregations in Elasticsearch, and what are their types?
How do you perform date histogram aggregations?
Explain nested aggregations with an example.
How do you monitor Elasticsearch cluster health and performance?
How do you secure an Elasticsearch cluster?
What is Index Lifecycle Management (ILM)?
What are aliases in Elasticsearch and how are they used?
Explain the concept of index templates.
What are Elasticsearch snapshots and how do you implement backup strategies?
How do you implement search suggestions and autocomplete in Elasticsearch?
What is the difference between query context and filter context?
How do you change a mapping that can't be updated in place?
How do you model relationships when Elasticsearch has no joins?
How do you paginate deeply without the from and size penalty?
How does Elasticsearch support vector and semantic search?
What are doc values and why do they matter?
What is the difference between Elasticsearch and Solr?
Explain hot-warm-cold architecture in Elasticsearch.
What is the split-brain problem and how does Elasticsearch prevent it?
What are the best practices for Elasticsearch performance optimization?
What is the difference between index and search performance tuning?
How do you scale an Elasticsearch cluster?
Walk through what happens internally when you index a document.
How do you debug a slow search query in Elasticsearch?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
44 of 49 Elasticsearch answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.