What is “Inverted Search” or “Inverted Index”?
Elasticsearch (like most search engines) uses an inverted index to make full-text search fast and efficient.

π§ Think of it like this:
Instead of storing documents and searching each one linearly (which is slow), Elasticsearch:
- Breaks down documents into terms (words).
- Creates a map from each term to the list of documents (and positions) where the term appears.
This mapping is the inverted index β it’s “inverted” because it maps from terms β documents (instead of documents β terms).
π Example
Letβs say you index the following 3 documents:
json
CopyEdit
1: “Elasticsearch is fast”
2: “Elasticsearch is powerful”
3: “Search engines use inverted indexes”
Elasticsearch creates an inverted index like:
Term | Document IDs |
elasticsearch | 1, 2 |
is | 1, 2 |
fast | 1 |
powerful | 2 |
search | 3 |
engines | 3 |
use | 3 |
inverted | 3 |
indexes | 3 |
So now, when you search for elasticsearch, it instantly knows documents 1 and 2 are matches.
β Inverted Search in Action
Suppose you run this query:
json
CopyEdit
GET /my_index/_search
{
“query”: {
“match”: {
“text”: “elasticsearch”
}
}
}
π Elasticsearch looks up the term elasticsearch in the inverted index and returns document IDs 1 and 2.
π Why Is This Powerful?
- Fast lookup β even for large datasets.
- Enables full-text search, filtering, scoring, highlighting, etc.
- Scales well across distributed nodes.
π Summary
Traditional Index | Inverted Index |
Document β Terms | Term β Documents |
Elasticsearch uses inverted index for efficient full-text search, letting it quickly retrieve all documents that contain a specific term (or combination of terms).

GIPHY App Key not set. Please check settings