What is an inverted index in Elasticsearch, and how do text and keyword differ?
Short answer
An inverted index maps each term to the list of documents containing it, like a book's index. text goes through an analyzer for full-text search; keyword keeps the string as-is for exact filtering, sorting and aggregations.
3 points to say:
- Inverted index: term → list of documents; finding a word is a term lookup, not a scan of every document.
textis analyzed formatch;keywordis the raw string forterm, sort, aggregate; the analyzer must be the same at index and search time.- Vietnamese: folding strips accents + an accented sub-field that gets boosted.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.