ElasticSearch ElasticSearch MCQ 5 — Questions and Answers
Question 1: What is the purpose of the Elasticsearch 'alias' feature?
- To rename a field within a mapping
- To create a secondary name pointing to one or more indices, enabling zero-downtime reindexing (Correct answer)
- To create a snapshot of an index
- To define a custom analyzer with a different name
Correct answer: To create a secondary name pointing to one or more indices, enabling zero-downtime reindexing
Index aliases provide an alternate name for one or more indices, allowing transparent switching between index versions during reindexing without application changes.
Question 2: Which Elasticsearch query is most appropriate for implementing autocomplete or prefix-based search functionality?
- fuzzy
- match_phrase
- prefix or completion suggester (Correct answer)
- more_like_this
Correct answer: prefix or completion suggester
The prefix query or the completion suggester (with 'completion' mapped field type) are specifically designed for efficient prefix-based and autocomplete search scenarios.
Question 3: What is the default behavior of Elasticsearch when you index a document with an existing ID?
- It creates a second document with the same ID
- It rejects the request with a conflict error
- It fully replaces the existing document and increments the version (Correct answer)
- It merges the new fields with the existing document
Correct answer: It fully replaces the existing document and increments the version
Indexing a document with an existing ID replaces the entire document and increments the internal version number; for partial updates, use the Update API.
Question 4: Which Elasticsearch component is responsible for converting text into tokens during indexing and search?
- Tokenizer only
- Character filter only
- Analyzer (which chains character filters, tokenizer, and token filters) (Correct answer)
- Normalizer
Correct answer: Analyzer (which chains character filters, tokenizer, and token filters)
An analyzer is the full analysis chain consisting of optional character filters, a required tokenizer, and optional token filters that together transform text into searchable tokens.
Question 5: In Elasticsearch, what does a 'nested' field type enable that a standard 'object' type does not?
- Storing arrays of objects where each object can be independently queried (Correct answer)
- Faster indexing of complex JSON objects
- Cross-index joins between related documents
- Storing objects with more than 100 fields
Correct answer: Storing arrays of objects where each object can be independently queried
The nested type stores each object in an array as a separate hidden Lucene document, allowing queries that match across fields within the same array object independently.
Question 6: Which setting must you configure to enable cross-cluster replication (CCR) in Elasticsearch?
- A remote cluster connection defined in the local cluster's settings (Correct answer)
- A shared NFS mount between leader and follower clusters
- A dedicated CCR node role on each cluster
- Enabling the xpack.security.enabled setting
Correct answer: A remote cluster connection defined in the local cluster's settings
CCR requires configuring a remote cluster connection (using cluster.remote settings or the Remote Clusters UI) so the follower cluster can communicate with the leader cluster.
Question 7: What is the purpose of the Elasticsearch 'force merge' operation?
- To merge two separate indices into one
- To reduce the number of Lucene segments in an index shard, reclaiming disk space from deleted documents (Correct answer)
- To force all pending writes to disk immediately
- To merge multiple cluster states into a single consistent state
Correct answer: To reduce the number of Lucene segments in an index shard, reclaiming disk space from deleted documents
Force merge reduces the number of Lucene segments per shard and permanently removes deleted documents, but should only be run on read-only indices as it is I/O intensive.
What is the purpose of the Elasticsearch 'alias' feature?