Learn Elasticsearch

Distributed search and analytics engine for full-text, logs and vectors

19 lessons · 4 hours · 4 levels · covers Elasticsearch 9.x

Elasticsearch is a distributed search and analytics engine built on Apache Lucene. You index JSON documents and query them over a REST API with relevance-ranked full-text search, filters, aggregations and vector search. It powers site search, log and metrics analytics (the Elastic Stack) and retrieval for AI applications.

Before you start

Elasticsearch builds on these; the tree links to the exact lessons you need.

How deep do you want to go?

1. EssentialsRead and write simple code, do the everyday basics6 lessons · 57 min in total
2. PracticalUse it productively at work, with the usual idioms12 lessons · 2 hours in total
3. AdvancedThe less common features, performance and trade-offs16 lessons · 3 hours in total
4. ExpertInternals and the edge cases experts know19 lessons · 4 hours in total

The Elasticsearch tree

ElasticsearchIndices, documents and the REST APIIndices, documentsand the REST APIIndexing, getting and updating documentsIndexing, getting andupdating documentsSearch basics and the match querySearch basics andthe match queryMappings: text vs keywordMappings: text vskeywordExact values: term, terms and rangeExact values: term,terms and rangeCombining queries with boolCombining querieswith boolText analysis and analyzersText analysis andanalyzersRelevance scoring and tuningRelevance scoringand tuningAggregationsAggregationsSorting and deep paginationSorting and deeppaginationBulk indexing and refreshBulk indexing andrefreshES|QL piped queriesES|QL piped queries
Essentials and Practical shown (12 of 19 lessons); the full list is below. Click a lesson to read it.

All 19 lessons, in order

Documents and indices

  1. Indices, documents and the REST API · Essentials · 8 min

    Elasticsearch stores JSON documents in indices and exposes everything through a REST API.

  2. Indexing, getting and updating documents · Essentials · 9 min

    Create, read, update and delete single documents and understand versions and auto-generated ids.

Searching

  1. Search basics and the match query · Essentials · 10 min

    Run _search with a match query, read hits and scores, and control which fields are returned.

  2. Exact values: term, terms and range · Essentials · 9 min

    Filter on exact keyword values, numbers and dates with term, terms, range and exists queries.

  3. Combining queries with bool · Essentials · 10 min

    Combine full-text and exact conditions with must, should, filter and must_not, and know which affect scoring.

  4. Relevance scoring and tuning · Practical · 13 min

    Understand BM25 scoring and tune relevance with field boosts, phrase matching, function_score and explain.

  5. Sorting and deep pagination · Practical · 10 min

    Sort results by fields and page through them with from/size for shallow pages and search_after with a point in time for deep ones.

  6. Vector and hybrid search · Advanced · 14 min

    Store embeddings in dense_vector fields, run approximate kNN search, and combine it with keyword search.

Mappings and text analysis

  1. Mappings: text vs keyword · Essentials · 11 min

    Define field types explicitly, especially text for full-text search versus keyword for exact values, sorting and aggregations.

  2. Text analysis and analyzers · Practical · 13 min

    See how analyzers turn text into terms with character filters, tokenizers and token filters, and build custom ones.

  3. Objects, arrays and nested fields · Advanced · 11 min

    Understand how arrays of objects are flattened and use the nested type and query to keep their fields together.

Aggregations and ES|QL

  1. Aggregations · Practical · 13 min

    Compute facets, statistics and histograms with terms, metric, date_histogram and nested sub-aggregations.

  2. ES|QL piped queries · Practical · 10 min

    Query, filter, transform and aggregate data with the piped ES|QL language via the _query API.

Managing data

  1. Bulk indexing and refresh · Practical · 11 min

    Load and change many documents efficiently with the _bulk API, update_by_query and refresh settings.

  2. Aliases and zero-downtime reindexing · Advanced · 11 min

    Point applications at aliases and swap them atomically after reindexing into a new index with a changed mapping.

  3. Data streams and lifecycle management · Expert · 13 min

    Store time-series data in data streams with rollover and manage retention and tiers with lifecycle policies.

Cluster and internals

  1. Shards, replicas and cluster health · Advanced · 13 min

    Size primary shards and replicas, read green/yellow/red health, and understand how nodes share the work.

  2. Lucene segments, refresh, flush and merges · Expert · 14 min

    Learn how each shard stores an inverted index in immutable segments and how refresh, translog, flush and merging work.

  3. Distributed search: query then fetch · Expert · 13 min

    Follow a search through the coordinating node, the query and fetch phases, routing, and per-shard scoring effects.