Debug School

Akanksha
Akanksha

Posted on

Top 30 Elastic Search Interview Questions with Answers

1. What is Elasticsearch primarily used for?

a) Document-oriented storage
b) Relational database management
c) Real-time search and analytics
d) Video streaming
Answer: c) Real-time search and analytics

2. Which of the following is not a core data structure in Elasticsearch?

a) Index
b) Node
c) Document
d) Table
Answer: d) Table

3. In Elasticsearch, what is a "shard"?

a) A type of query
b) A distributed index
c) A document
d) A REST API endpoint
Answer: b) A distributed index

4. How is data stored in Elasticsearch?

a) In tables
b) In documents
c) In rows
d) In directories
Answer: b) In documents

5. What is the maximum number of primary and replica shards allowed in a single index in Elasticsearch?

a) No limit
b) 100 primary, 1 replica
c) 1 primary, 100 replica
d) 100 primary, 100 replica
Answer: a) No limit

6. Which HTTP methods are used in Elasticsearch for CRUD (Create, Read, Update, Delete) operations?

a) GET and POST
b) POST and PUT
c) PUT and DELETE
d) GET, POST, PUT, and DELETE
Answer: d) GET, POST, PUT, and DELETE

7. What is the default port for Elasticsearch HTTP REST API?

a) 80
b) 9200
c) 443
d) 9300
Answer: b) 9200

8. Which query type in Elasticsearch is used for full-text search?

a) Boolean Query
b) Term Query
c) Match Query
d) Filtered Query
Answer: c) Match Query

9. What is the purpose of the "analyzer" in Elasticsearch?

a) It is used to sort documents alphabetically.
b) It specifies the format of date fields.
c) It is used to preprocess text during indexing and searching.
d) It defines how Elasticsearch handles numeric data.
Answer: c) It is used to preprocess text during indexing and searching.

10. Which query returns an exact match for a term in Elasticsearch?

a) Match Query
b) Term Query
c) Fuzzy Query
d) Multi-match Query
Answer: b) Term Query

11. What is the role of an Elasticsearch "Node" in a cluster?

a) It stores and indexes data.
b) It is a container for documents.
c) It provides the REST API.
d) It holds a replica of data for high availability.
Answer: a) It stores and indexes data.

12. Which type of query is best suited for filtering data in Elasticsearch?

a) Match Query
b) Term Query
c) Filtered Query
d) Multi-match Query
Answer: c) Filtered Query

13. What is the purpose of the "routing" parameter in Elasticsearch?

a) It defines the mapping of fields in an index.
b) It specifies the path for data storage.
c) It determines which shard a document is stored in.
d) It controls access to Elasticsearch.
Answer: c) It determines which shard a document is stored in.

14. Which Elasticsearch feature allows you to group and aggregate data based on a specific field?

a) Field Collapsing
b) Document Grouping
c) Bucket Aggregations
d) Field Filters
Answer: c) Bucket Aggregations

15. What is the purpose of a "mapping" in Elasticsearch?

a) It defines the structure of an index.
b) It represents a query to retrieve data.
c) It stores document metadata.
d) It is used for text analysis.
Answer: a) It defines the structure of an index.

16. What is the default scoring algorithm used by Elasticsearch?

a) BM25
b) TF-IDF
c) PageRank
d) Jaccard
Answer: a) BM25

17. What is the term for a collection of one or more related Elasticsearch indices?

a) Cluster
b) Shard
c) Node
d) Type
Answer: a) Cluster

18. Which Elasticsearch query allows you to search for documents containing terms in any order?

a) Term Query
b) Match Query
c) Phrase Query
d) Bool Query
Answer: b) Match Query

19. What is the purpose of a "filter" in Elasticsearch?

a) To boost the relevance score of documents.
b) To exclude documents from search results.
c) To extract data from documents.
d) To control access to the cluster.
Answer: b) To exclude documents from search results.

20. How is Elasticsearch different from traditional relational databases?

a) Elasticsearch enforces strict schema design.
b) Elasticsearch is optimized for real-time search and analytics.
c) Elasticsearch uses SQL for querying.
d) Elasticsearch doesn't support indexing.
Answer: b) Elasticsearch is optimized for real-time search and analytics.

21. What is the purpose of the "_source" field in Elasticsearch?

a) It stores the document ID.
b) It contains the source JSON document.
c) It specifies the index settings.
d) It is used for sorting documents.
Answer: b) It contains the source JSON document.

22. Which query type in Elasticsearch is used for combining multiple queries with logical operators?

a) Term Query
b) Match Query
c) Bool Query
d) Range Query
Answer: c) Bool Query

23. Which RESTful HTTP method is typically used for searching in Elasticsearch?

a) GET
b) POST
c) PUT
d) DELETE
Answer: a) GET

24. How does Elasticsearch achieve distributed storage and search?

a) By replicating data on multiple nodes
b) By using a single, large index
c) By centralizing all data on one node
d) By partitioning data into multiple tables
Answer: a) By replicating data on multiple nodes

25. What is the role of an Elasticsearch "Index"?

a) It defines the structure of a document.
b) It represents a data store.
c) It groups related documents together.
d) It's a unique identifier for a node.
Answer: c) It groups related documents together.

26. Which query is used to search for documents within a specific date range in Elasticsearch?

a) Term Query
b) Date Range Query
c) Match Query
d) Range Query
Answer: d) Range Query

27. What does "bulk indexing" mean in Elasticsearch?

a) Inserting multiple documents in a single request
b) Searching for documents in parallel
c) Storing data in a separate index
d) Indexing documents with nested structures
Answer: a) Inserting multiple documents in a single request

28. In Elasticsearch, what is the purpose of the "refresh" API?

a) To restart the Elasticsearch server
b) To reload the index mappings
c) To apply recent changes and make them searchable
d) To optimize index performance
Answer: c) To apply recent changes and make them searchable

29. Which type of index is used to improve search performance by precomputing results for specific queries?

a) Analyzed Index
b) Nested Index
c) Sorted Index
d) Frozen Index
Answer: d) Frozen Index

30. What is the purpose of "snapshot and restore" in Elasticsearch?

a) To take a backup of the entire cluster
b) To restore deleted documents
c) To save index mappings
d) To restore a corrupted node
Answer: a) To take a backup of the entire cluster

Top comments (0)