Elasticsearch Reference
|
This section documents the current Elasticsearch 9.x line (with 8.19 as the final 8.x release) as published at the Elasticsearch documentation, which is the reference these pages are written and verified against. No specific patch version is pinned. Some capabilities (Kibana-only UIs, the ML/NLP model-management workflow, cross-cluster replication, and parts of the paid / serverless-only surface) are linked, not documented in depth. This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production, as Elasticsearch iterates quickly. This section’s bibliography lists the reference material consulted while preparing these pages. |
Welcome to the Elasticsearch reference. Elasticsearch is a distributed, near-real-time JSON document store and search / analytics engine built on Apache Lucene: it stores each record as a JSON document in an index, analyzes text into an inverted index of terms for relevance-ranked full-text search, exposes a rich JSON Query DSL (plus ES|QL, EQL and SQL) and an aggregation framework for real-time analytics, and shards every index across a cluster with automatic replication and failover. This section documents the current Elasticsearch line as a database-developer reference — the data model, mapping and analysis, indexing and querying, relevance and aggregations, the distributed model, index lifecycle, tuning, operations and security, and the clients — written and verified against the Elasticsearch documentation.
If you are new to Elasticsearch, read What Elasticsearch is & how to run it first, then Documents, indices & the inverted index and Mapping & field types, followed by The search API, paging & sorting. Everything after that builds on those foundations.
For the relational and document-database baselines this section contrasts with, see the sibling SQL Reference, MongoDB Reference and Couchbase Reference, which the Elasticsearch pages cross-link rather than restate. For where a dedicated search engine fits alongside a primary store, see Choosing the Right Database. For the other mature Lucene-based search server and how the two compare, see Solr vs. Elasticsearch.
What’s covered
Getting started
-
What Elasticsearch is & how to run it — Elasticsearch as a distributed, Lucene-based JSON document and search / analytics engine, its place in the Elastic Stack, the release line, running a node (Docker, the archive, Elastic Cloud / serverless), the Kibana Dev Tools Console and
curlconventions used throughout this section, and a first index / search round-trip.
Data model, mapping & analysis
-
Documents, indices & the inverted index — a document as JSON with
_sourceand metadata fields, an index as documents + settings
mappings, one type per index, the inverted index and Lucene segments, and near-real-time search with the refresh cycle. -
Mapping & field types — dynamic vs. explicit mapping, the main field data types (
textvs.keyword, numeric,date,objectvs.nested,flattened,geo_point/geo_shape,dense_vector,join,completion), multi-fields, mapping parameters, metadata fields, dynamic templates, runtime fields, and preventing mapping explosion. -
Text analysis: analyzers, tokenizers & token filters — the character filters / tokenizer / token filters chain, the built-in analyzers and the
_analyzeAPI, custom analyzers andsearch_analyzer, normalizers, and the tokenizers and token filters behind partial matching, stemming, stop words and synonyms.
Indexing
-
Indexing, CRUD, bulk & concurrency control — the single-document APIs (index / get / update / delete, partial and scripted updates,
upsert), the multi-document APIs (_bulk,_mget,_update_by_query/_delete_by_query,_reindex), optimistic concurrency control with_seq_no/_primary_term, and therefreshrequest parameter. -
Ingest pipelines & processors — ingest-node pipelines and processors (
set,grok,dissect,date,geoip,script,enrich,pipeline),on_failurehandling, the_simulateAPI, anddefault_pipeline/final_pipeline.
Searching & analytics
-
The search API, paging & sorting — the
_searchendpoint and response envelope, query vs. filter context, choosing fields (_sourcefiltering,fields,docvalue_fields), sorting, and pagination withfrom/size, keyset-stylesearch_after+ point-in-time, andscroll. -
Full-text queries —
match,match_phrase,match_phrase_prefix,multi_matchand its types,combined_fields,query_string/simple_query_string, andintervals. -
Term-level queries —
term,terms(and terms-lookup),terms_set,rangewith date math,exists,ids, and the expensiveprefix/wildcard/regexp/fuzzyqueries. -
Compound queries, relevance & scoring —
bool/dis_max/constant_score/boosting, BM25 as the default similarity, the_explainAPI, query-timeboostand named queries,function_scoreandscript_score, andrescore. -
Aggregations — the metric, bucket and pipeline families, running aggregations on the query result set, sub-aggregations and nesting, and the approximate-count / approximate-percentile trade-offs.
-
Joins & relationships —
objectvs.nested, thejoinfield for parent-child (has_child/has_parent),terms-lookup joins, and denormalizing vs. application-side joins. -
Search extras: highlighting, suggesters, collapse, percolation & more like this — highlighting, the
term/phrase/completionsuggesters and thesearch_as_you_typefield, resultcollapseand_msearch, search templates, thepercolatequery, andmore_like_thisfor finding similar documents. -
Geospatial data & queries —
geo_pointandgeo_shapemappings and coordinate formats, the geo queries (geo_bounding_box,geo_distance,geo_shape,geo_grid), and the geo aggregations (geohash_grid/geotile_grid,geo_bounds,geo_centroid). -
Vector & semantic search —
dense_vectormapping and kNN search (approximate and exact, filtered),sparse_vector/ ELSER, thesemantic_textfield and thesemanticquery, and retrievers (standard,knn,rrf,text_similarity_reranker) for hybrid search. -
Query languages & scripting — when to reach for ES|QL (piped), EQL (event sequences), Elasticsearch SQL (
_sql, JDBC / ODBC) or KQL / Lucene syntax instead of the Query DSL, and Painless scripting (script contexts,params, stored scripts).
Distributed model & operations
-
Cluster, nodes & shards — the cluster / node / index / shard / segment model, primary and replica shards, node roles and the data tiers, discovery and master election, routing and query-then-fetch search, and cluster health.
-
Index lifecycle & scaling — shard sizing and time-based indices, aliases and the write alias, index and component templates, data streams and rollover, ILM phases and actions, the data-stream lifecycle, downsampling, and searchable snapshots.
-
Performance & the storage/caching model — tuning for indexing speed (
_bulk,refresh_interval, the translog, segment merges) and search speed (query vs. filter context, the node query and shard request caches), thefielddatatrap anddoc_values, and tuning for disk usage. -
Administration, monitoring & snapshots — the
_catAPIs and the cluster / nodes stats APIs, what to watch (heap, thread-pool rejections, disk watermarks, unassigned shards, slow logs), and snapshot & restore with snapshot lifecycle management. -
Securing a cluster — transport and HTTP TLS and the enrollment flow, the authentication realms and API keys, role-based access control with field- and document-level security, and the audit log.
-
Clients & REST API conventions — the official language clients and what they share, the REST API conventions (multi-target syntax, date math in index names,
?filter_pathand the common options), and the REST API compatibility policy.
Cheat sheet
-
Cheat Sheet (PDF) — a single-page, printable summary of everything in this section, with a downloadable PDF.
Bibliography
-
Elastic Docs and the Elasticsearch Reference — the source every page in this section is written and verified against; see in particular Elasticsearch intro and Documents and indices, Mapping, Field data types, Mapping parameters and Runtime fields, Text analysis, the Document APIs, Bulk API and Optimistic concurrency control, Ingest pipelines, Search your data and Paginate search results, the Query DSL (full text, term-level and compound), Relevance scoring theory and
function_score, Aggregations, Joining queries, Highlighting and Suggesters, Geo queries, kNN search, Semantic search and Retrievers, ES|QL, EQL, SQL and Scripting, Scalability and Node roles, Size your shards, Aliases, Index templates, Data streams and ILM, Tune for indexing speed, Tune for search speed and Tune for disk usage, the cat APIs, Monitor a cluster and Snapshot and restore, Secure the cluster, User authentication and User authorization, and API conventions, the REST APIs and the Elasticsearch clients. -
Elasticsearch: The Definitive Guide (Clinton Gormley & Zachary Tong, O’Reilly / Elastic) — the older but still useful conceptual companion published by Elastic; consulted as background, and superseded by the reference above for anything version-specific.
-
Gheorghe, Radu; Hinman, Matthew Lee; Russo, Roy. Elasticsearch in Action (Manning Publications, 2016; ISBN 9781617291623). Consulted as part of the bibliography for this section; its code targets Elasticsearch 1.5 / the 1.x branch, so where it and the official documentation disagree the official documentation is authoritative and the difference is noted, and none of its content is the primary or main reference for this section — see the publisher’s book page and manning.com.
-
Konda, Madhusudhan. Elasticsearch in Action, Second Edition (Manning Publications, 2023; ISBN 9781617299858) — a ground-up rewrite of the book above covering Elasticsearch 8.x, listed as a pointer to a current-generation treatment of the same material — see the publisher’s book page.
-
The books above are consulted bibliographic references only. They are not the primary or main reference for this section, and where they and the official documentation disagree, the official documentation is authoritative and the difference is noted.