Elasticsearch shards, replicas and refresh
medium 4 minA primary shard is a partition of an index.
Video lesson · Chapter 1 of 5
The merchant can read a missing search result
Four shards, one search page
1:21Reel
Theory
Read or listen first. About 1 min.
What it is
A search shard knows its local contenders. The coordinator needs enough scored candidates from every shard to discover the global winners before requesting full document bodies.
How four shards produce one results page
Why it exists
Moving IDs and scores first keeps losing documents off the network. The merge assumes the scores use a comparable scale across shards.
Words to know
- Fetch phase
- The stage that retrieves the full records for the globally selected search hits.
How it works
Step through the idea, or press Play.
Fan out. Send the query to an eligible copy of each target shard.
Understand it
Worked example
Elasticsearch shards, replicas and refresh in practice
Across four shards, request each shard’s top ten for a global top ten, merge the returned candidates, then fetch the selected documents. A newly written document may need a refresh before appearing in search.
Related case
Why did this document rank first?
An internal engineering search returns a long glossary above a precise two-paragraph runbook. Another user cannot find a document they just published.
Check refresh, terms and access filters.