InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What do you mean by NRT (Near Real-Time Search) in ElasticSearch? |
|
Answer» Elasticsearch provides near real-time search functionality. It MEANS that there is a slight DELAY (approximately one second) between the time you index a DOCUMENT and the moment it becomes SEARCHABLE. |
|
| 2. |
What do you mean by the term ‘type’ in ElasticSearch? |
|
Answer» Types are logical categories or parts of an index whose semantics are determined by the user. Elasticsearch clusters can consist of multiple Indices (databases), each of which contains several Types (tables). A TYPE HOLDS multiple Documents (rows), and every document has some Properties (COLUMNS). By using types, multiple DATA types can be stored in the same index, thus reducing the total number of indices. Example: Suppose, in your CAR manufacturing scenario, you had a Tatafactory index. There are three types (tables) in this index as follows:
Every type then contains documents relevant to that type (e.g. a Tata Innova document is housed in the Cars type). In this document, you can find all the information about the particular car. |
|
| 3. |
How to add a mapping to an index? |
|
Answer» Elasticsearch lets you add the mapping to an index BASED on the DATA provided by the USER in the REQUEST body. The following syntax can be used to add a mapping to an index: Syntax: POST /_<index_name>/_type/_id |
|
| 4. |
What is the process of deleting an index in Elasticsearch? |
|
Answer» Deleting an index removes all of its shards, DOCUMENTS, and metadata. Use the following command to delete an index in Elasticsearch: DELETE /<index_name>EXAMPLE: To delete an index named my-index-321, we use the following command. DELETE /my-index-321 |
|
| 5. |
Define the terms Shard and Replica in ElasticSearch. |
|
Answer» Shard: Elasticsearch crashes are often caused by LARGE indexes. Due to the unlimited number of documents that can be stored on each index, an index may consume more disk space than the hosting server can provide. Indexing will begin to FAIL as soon as the index reaches this limit. As a SOLUTION to this problem, it is possible to divide or segment indexes horizontally into MULTIPLE pieces, also called shards. For an index, you can easily specify how many shards you want. As a result, every shard is its own, fully functional, and independent "index", which can run on any node in a cluster. Replica: As the name implies, replicas are Elasticsearch fail-safe mechanisms, and are essentially copies of an index's shards. As a backup, this could come in handy when a node crashes. Furthermore, replicas can serve read requests, which is useful for increasing search performance. To ensure HIGH availability, replicas must not be placed on the same node as the original shard (called the "primary shared") from which they were replicated. |
|
| 6. |
What is an index in ElasticSearch? |
|
Answer» An index is a COLLECTION of DOCUMENTS that are somewhat similar in nature. As an example, you could have an index of customer data, another ONE of product catalogs, and another one of order data. The name of an index (which must be all lowercase) serves as an identifier for the index when indexing, SEARCHING, updating, and deleting documents contained within it. An index (plural: indices) can have one or more than one shards and replicas. |
|
| 7. |
Which operations can you perform on a document? |
|
Answer» ELASTICSEARCH allows the FOLLOWING OPERATIONS to be PERFORMED over documents:
|
|
| 8. |
Explain what is a document in ElasticSearch. |
|
Answer» The term "document" refers to a unit of information that can be indexed. Each index WITHIN Elasticsearch CONTAINS multiple documents. For instance, you could have a document for EVERY customer, another for every order, etc. These documents are written in JavaScript Object Notation (JSON), which is a widely used format for internet data exchange. Documents are composed of fields, and each field has its own TYPE of data. In a particular index, you can store as many documents as you wish. |
|
| 9. |
Explain a node in Elastic Search. |
|
Answer» You can think of a NODE as a SINGLE server that forms part of your cluster. Nodes are assigned roles that describe their responsibilities and operations. By default, EVERY cluster node can handle HTTP and transport TRAFFIC. Communication between nodes is CARRIED out via the transport layer, while REST clients utilize the HTTP layer. Nodes in a cluster are aware of each other and can forward client requests to the right node. |
|
| 10. |
What is cluster in ElasticSearch? |
|
Answer» A cluster is a COLLECTION of connected nodes. If you run only one instance or node of Elasticsearch, then you have a single-node cluster or a cluster of one node. CLUSTERS automatically REORGANIZE themselves when nodes join or leave so the data is DISTRIBUTED evenly among all the nodes. Despite being fully functional, the cluster is at risk of data LOSS if it fails. |
|
| 11. |
What is ElasticSearch fuzzy search? |
|
Answer» With fuzzy search, you can FIND DOCUMENTS with terms similar to your search term based on a Levenshtein edit distance measure. Edit distance is essentially the number of single-character changes or edits required to change one term into another. Among these changes are:
Within a SPECIFIC edit distance, the fuzzy query generates a list of all POSSIBLE variations and expansions of the search term. After that, the query returns a list of all possible matches. The most relevant and exact matches APPEAR near the top of the list. |
|
| 12. |
What is ElasticSearch Mapping? |
|
Answer» ElasticSearch mappings define how documents and their FIELDS are indexed and stored in ElasticSearch databases or ElasticSearch DBs. This DEFINES the types and formats of the fields that appear in the documents. As a result, MAPPING can have a significant impact on how Elasticsearch searches for and stores data. After creating an index, we MUST define the mapping. An incorrect preliminary definition and mapping might lead to incorrect search results. Types of mapping
|
|
| 13. |
How do you stop the ElasticSearch search service from running on a Linux server? |
|
Answer» To shut down or turn off the Elasticsearch service on a Linux server, you will need to 'KILL' the running process. It is accomplished by sending a SIGTERM REQUEST to the process, which ends or terminates it. In order to initiate the shutdown process, you must first determine the process identifier (PID) for the Elasticsearch service you wish to terminate. GREP command can be USED to locate PROCESSES easily. If you wish to locate all Elasticsearch-related processes running on a server, you can use the following command: ps -ef | grep elasAfter identifying the correct PID, simply execute a kill command with the PID of the Elasticsearch process. Upon successful execution of the kill command, Elasticsearch should no longer be running. |
|
| 14. |
Can you please list out different ElasticSearch data types for the document fields? |
|
Answer» Field types (also CALLED field data types) describe the type of information or data a field contains, such as a string or boolean, and its intended use. The following are some data types for document fields: Common data types:
Objects and relational types:
Structured and Spatial data types: |
|
| 15. |
How does ElasticSearch work? |
|
Answer» The Working of ElasticSearch is summarized as follows:
|
|
| 16. |
What is ElasticSearch used for? |
|
Answer» Elasticsearch's speed and scalability as well as its ability to index different TYPES of data make it ideal for a number of use cases. In addition to its high scalability, Elasticsearch also offers near-real-time search capabilities. All this adds up to a solution that offers much more than a search engine and supports many operational and critical business use cases. Since Elasticsearch has powerful search capabilities, it is typically the underlying TECHNOLOGY for APPLICATIONS requiring complex search requirements. Listed below are some of the use cases of ElasticSearch:
|
|
| 17. |
What are the advantages of ElasticSearch? |
|
Answer» ElasticSearch's advantages can be listed or summarized as FOLLOWS:
|
|