Build the mental model
Elasticsearch is a search and analytics engine that stores JSON documents and uses a data structure called an inverted index to find matching words inside text extremely fast. A relational database like PostgreSQL can technically do text matching with `LIKE '%keyword%'` or a basic full-text search extension, but those approaches get slower as tables grow and do not natively handle typo tolerance, relevance ranking (which result matters most), or synonym matching well. Elasticsearch exists specifically to solve that class of problem: when you index a text field, it breaks the text into individual tokens (words) at write time and builds an inverted index from those tokens, so it can find relevant documents among millions in milliseconds rather than scanning row by row. Elasticsearch is rarely used to replace a database outright — it usually sits alongside an existing one (PostgreSQL, in this course) as a specialized search layer, where the database keeps being the source of truth and a search-optimized copy of the data gets synced into Elasticsearch. A useful mental model is a library: PostgreSQL is the master ledger recording each book's official facts (title, author, ISBN, availability), while Elasticsearch is the card-index catalog that lets you search inside every book's content by topic or keyword almost instantly. This course moves from installation and the basics, through mapping, the Query DSL, and aggregations, up to production concerns like security, performance, and cluster architecture.
Connect it to a real scenario
Throughout this course we use a running example called the Tutorial Platform, a PostgreSQL-backed course and lesson catalog — the same project the Redis course added a cache and session layer to; here we add a full-text search layer. Searching tutorial titles, lesson body text, and tags directly in PostgreSQL with something like `ILIKE '%redis%'` gets slower as the tutorial count grows, and a user searching "redi cache" (a typo) would get zero results. Instead, we sync an Elasticsearch index from PostgreSQL, and every search UI on the site queries that index for results, while PostgreSQL remains the source of truth for every create, edit, and delete operation. Each lesson builds this search backend one layer at a time — from installation, through mapping, indexing, querying, and aggregations, to client integration.
Try the working example
PostgreSQL (source of truth)
tutorials, lessons, tags tables
|
| sync (bulk index / CDC)
v
Elasticsearch index ("tutorials")
inverted index over title, body, tags
|
| search queries (Query DSL)
v
Tutorial Platform search UI
instant, typo-tolerant, ranked resultsYou can explain what problem Elasticsearch solves and preview this course's project.5-minute try-it
Think of a website search box you have used. Predict what would happen if you searched with a typo (would you still get results?). Write three reasons why a single PostgreSQL `LIKE` query struggles to provide that kind of typo tolerance.
One important caution
Treating Elasticsearch as a full PostgreSQL replacement and trying to store transactional data (orders, payments) only in Elasticsearch — it lacks strong ACID transaction guarantees.
Loading data into Elasticsearch once manually and forgetting that a real sync mechanism is needed to keep it reflecting ongoing PostgreSQL updates — the index silently goes stale otherwise.