Elasticsearch Interview Questions and Answers
Ques 31. What is a shard in Elasticsearch?
A shard is a basic unit of storage and search in Elasticsearch. Indexes are divided into shards to distribute data across multiple nodes for scalability.
Example:
PUT /my_index/_settings
{
"number_of_shards": 5
}
Ques 32. How does Elasticsearch handle security?
Elasticsearch provides security features like role-based access control, SSL/TLS encryption, and authentication mechanisms.
Ques 33. Explain the purpose of the term 'mapping' in Elasticsearch.
Mapping in Elasticsearch is the process of defining how a document and its fields are stored and indexed. It helps in defining the data type, analysis, and other properties.
Example:
PUT /my_index
{
"mappings": {
"properties": {
"title": { "type": "text" }
}
}
}
Ques 34. Explain the term 'Bulk API' in Elasticsearch.
The Bulk API allows for the efficient indexing and deletion of multiple documents in a single request.
Ques 35. What is the role of a filter in Elasticsearch?
Filters in Elasticsearch are used to narrow down the search results based on specific criteria. They are applied to queries to exclude or include documents in the search.
Example:
GET /my_index/_search
{
"query": {
"bool": {
"filter": {
"range": {
"price": { "gte": 20 }
}
}
}
}
}
Most helpful rated by users: