ElasticSearch Case Studies & Practical Application 4 — Questions and Answers
Question 1: A real-estate app needs to find all properties within 10 km of a user's location. Which Elasticsearch query should be used?
- Geo bounding box query
- Geo distance query (Correct answer)
- Geo polygon query
- Geo shape query
Correct answer: Geo distance query
The geo distance query returns documents where a geo_point field falls within a specified radius from a center coordinate.
Question 2: A startup indexes user-generated reviews. They need to surface the most helpful reviews first while still factoring in relevance to the search query. What is the best approach?
- Sort by helpful_votes descending only
- Use function score combining BM25 score with a field_value_factor on helpful_votes (Correct answer)
- Use a bool query with must and should clauses
- Use a rank feature field on helpful_votes
Correct answer: Use function score combining BM25 score with a field_value_factor on helpful_votes
Function score with field_value_factor blends the text relevance score with numeric signals like helpful_votes into a single composite score.
Question 3: An engineering team notices that bulk indexing throughput drops dramatically during peak search traffic. Which configuration change reduces this contention?
- Increase the number of primary shards
- Use separate node roles: dedicated data nodes and dedicated coordinating nodes (Correct answer)
- Enable adaptive replica selection
- Increase queue size for bulk thread pool
Correct answer: Use separate node roles: dedicated data nodes and dedicated coordinating nodes
Assigning dedicated coordinating nodes for search and dedicated data nodes for indexing separates workloads, preventing indexing from competing with search resources.
Question 4: A media company ingests video metadata and wants to allow 'did you mean?' spell-correction suggestions. Which Elasticsearch suggester should they implement?
- Completion suggester
- Term suggester
- Phrase suggester (Correct answer)
- Context suggester
Correct answer: Phrase suggester
The Phrase suggester evaluates multi-word corrections using n-gram language models, making it ideal for 'did you mean?' sentence-level corrections.
Question 5: A logistics company stores package tracking events and queries them by package_id. They notice queries are always slow despite the field being indexed. What should they check first?
- Whether package_id is mapped as text instead of keyword (Correct answer)
- Whether the index has enough replica shards
- Whether the circuit breaker is triggered
- Whether the refresh interval is too long
Correct answer: Whether package_id is mapped as text instead of keyword
A text-mapped package_id field is analyzed and cannot use efficient term-level lookups; remapping it to keyword enables fast exact-match queries.
Question 6: A publishing company needs to highlight matching search terms in returned article excerpts. Which Elasticsearch component handles this?
- Suggester API
- Highlighter with unified, plain, or fvh type (Correct answer)
- Explain API
- Source filtering
Correct answer: Highlighter with unified, plain, or fvh type
Elasticsearch's Highlighter returns snippets of text with matching terms wrapped in tags, and supports unified, plain, and fast vector highlight (fvh) types.
Question 7: A company uses Elasticsearch for application performance monitoring and needs dashboards that aggregate p95 latency per service. Which aggregation computes this?
- Stats aggregation
- Percentiles aggregation (Correct answer)
- Extended stats aggregation
- Histogram aggregation
Correct answer: Percentiles aggregation
The Percentiles aggregation computes configurable percentile values (e.g., p95, p99) over a numeric field, making it ideal for latency analysis.
A real-estate app needs to find all properties within 10 km of a user's location.
Which Elasticsearch query should be used?