Elasticsearch medium
If you map a semi-structured field as `text`, which core capability do you lose compared to mapping it as `keyword`?
- A The ability to perform aggregations (grouping) and efficient sorting without massive memory overhead.
- B The ability to store strings longer than 255 characters.
- C The ability to search for the data using a `match` query.
- D Data durability; `text` fields are not persisted to the transaction log.
Answer: A. The ability to perform aggregations (grouping) and efficient sorting without massive memory overhead.
`Text` is for 'Human' reading (full-text search). It is broken into many small tokens. `Keyword` is for 'Machine' reading (IDs, Statuses). Keywords use 'Doc Values' (a columnar disk-based structure) which allows Elasticsearch to efficiently sort and group data without loading the entire index into RAM (Fielddata).
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- What are the two primary reasons for configuring one or more 'Replica Shards' for an index?
- When a String field is mapped as `text`, what process is performed to enable full-text search capability?
- What is the primary benefit of splitting an Elasticsearch index into multiple 'Primary Shards'?
- Every document stored in an Elasticsearch index is uniquely tracked by which mandatory metadata field?
- Elasticsearch search results include a metadata field called `_score`. What does this value primarily indicate?
- What is the primary architectural purpose of Elasticsearch in a modern software stack?