April 16, 2020

Part 2: Elastic Search Interview Questions And Answers

Explain the procedure to add or create an index in Elasticsearch Cluster?
To add a new index, create an index API option should be used. The parameters required to create the index is Configuration setting of an index, Fields mapping in the index as well as Index aliases.

How can we delete an index in Elasticsearch?
We can delete an existing index using the following syntax:
DELETE /index_name
We can use '_all' or '*' to remove/delete all the indices

How to list all indexes of a Cluster in Elasticsearch?
We can get the list of indices present in the cluster using the following syntax:
GET /index_name

What is the syntax to add a Mapping in an Index?
POST /index_name/type/id

What is the syntax to retrieve a document by ID in Elasticsearch?
GET index_name/doc/id

What are the various possible ways by which we can perform a search in Elasticsearch?
  • Applying search API across multiple types and multiple indexes: Search API, we can search an entity across multiple types and indices.
  • Search request using a Uniform Resource Identifier: We can search requests using parameters along with URI i.e. Uniform Resource Identifier.
  • Search using Query DSL i.e. (Domain Specific Language) within the body: DSL i.e. Domain Specific Language is utilized for JSON request body.
What are the various types of queries that Elasticsearch supports?
Queries are mainly divided into two types: Full Text or Match Queries and Term based Queries.
  • Text Queries such as basic match, match phrase, multi-match, match phrase prefix, common terms, query-string, simple query string.
  • Term Queries such as term exists, type, term set, range, prefix, ids, wildcard, regexp and, fuzzy.
What is the difference between Term-based queries and Full-text queries?
Domain Specific Language (DSL) Elasticsearch query which is known as Full-text queries utilizes the HTTP request body, offers the advantage of clear and detailed in their intent, over time it is simpler to tune these queries.

Term based queries utilize the inverted index, a hash map-like data structure that helps to locate text or string from the body of email, keyword or numbers or dates, etc. used in analysis purposes.

What is aggregation in Elasticsearch?
Aggregations help in the collection of data from the query used in the search. Different types of aggregations are Metrics, Average, Minimum, Maximum, Sum and stats, based on different purposes.

What is the data storage functionality in Elasticsearch?
Elasticsearch is a search engine used as storage and searching complex data structures indexed and serialized as a JSON document.

-K Himaanshu Shuklaa..

No comments:

Post a Comment