elasticsearch interview questions

Top Frequently Asked Elasticsearch Interview Questions

What is Elasticsearch ?

Elasticsearch is an open source search engine which is built on Apache Lucene.Lucene is an open source search library.Elasticsearch takes Lucene library and extends it to store and index and search data with good performance.Using Elasticsearch we can send data over HTTP in JSON for index, search.

What are the Elasticsearch features ?

Elasticsearch has following features.

  • Fast Searching : Elasticsearch index all data by default that helps to search faster.
  • Without Exact Match : Elasticsearch can be configured to match beyond exact match.It is useful when user does typo or does not know exact word for searching.
  • Relevant Result : Elasticsearch calculates relevancy score for a document and returns result which has close to our criteria.
  • Suggestion : We can help users for popular search when user starts typing.

What is the algorithm for calculating relevancy score ?

TF-IDF stands for Term Frequency-Inverse Document Frequency.In TF word appears more then it has higher score while in IDF uncommon word has higher score.

Is Elasticsearch replacement of data store ?

No its not replacement of data store.It provide indexing and searching fast but there are some functionality for which we need data store like transaction and complex relationship.

In Elasticsearch what is the default port for inter node communication ?


In Elasticsearch what is the default port for HTTP communication ?


How to identify a document uniquely in Elasticsearch ?

Index ID + Type ID + Document ID combination identifies uniquely.

What is Document in Elasticsearch ?

Document is a smallest unit of data that is indexed or searched in Elasticsearch.Document contains both field and value.It can be hierarchical as well ,it means document within document. Generally document is a JSON representation.

What are Types in Elasticsearch ?

Types are logical container of document in Elasticsearch.Types can be considered as table in database and document is a row.

What are Indices in Elasticsearch ?

Indices are logical container of Types in Elasticsearch.Indices can be considered as database and Types are table and document is a row.

What is shard in Elasticsearch ?

Shard is collection of files where Lucence stores data.

What is node in Elasticsearch ?

It is an instance of Elasticsearch.We can make cluster of nodes on same server.

What is Inverted index ?

Using inverted index Elasticsearch can find which document contains a term or word without looking all documents.

What is term dictionary in Elasticsearch ?

Term dictionary gives information that in which document this term is used

What is term frequency in Elasticsearch ?

Term frequency tells number of appearances of a term in a document.If frequesny is more then document is more relevant.

What is horizontal scaling in Elasticsearch ?

Adding more node in same cluster is called horizontal scaling because requests are distributed.

What is vertical scaling in Elasticsearch ?

Adding more resources to a node for example RAM or processor.That always increases performance.

How indexing and searching does work in Elasticsearch ?

To understand indexing and searching in Elasticsearch, follow link

Elasticsearch Indexing And Searching

How document can be indexed in Elasticsearch using cURL?

To understand indexing of document in Elasticsearch, follow link

Elasticsearch indexing example using curl

How document can be searched in Elasticsearch using cURL?

To understand searching of document in Elasticsearch, follow link

Elasticsearch searching example using curl

What is the significance of took filed in Elasticsearch search query result as shown in above image ?

It tells how much time Elasticsearch needed to process the request.

What is the significance of total filed in Elasticsearch search query result as shown in above image ?

It tells how many document match in Elasticsearch. By default Elasticsearch show 10 matching document but by total we can know how many document match the criteria.

What is the default operator used by Elasticsearch in searching words ?


What is the file name where we specify Elasticsearch options ?


What is the location of elasticsearch.yml file name in window ?


How to change cluster name in Elasticsearch ?

In elasticsearch.yml add one entry

cluster.name: your-cluster-name

Can we change existing mapping in Elasticsearch for example if a filed had type String , can we make it Integer ?


What are the core fields type in Elasticsearch ?

  • Boolean
  • String
  • Numeric
  • Date

How to index a field with multiple values or in easy word Array?

curl -XPUT 'localhost:9200/preparationforinterview/elasticsearch/topic' -d '{ "tags": ["indexing", "searching"] }'

What are the predefined fields in Elasticsearch ?

Predefined fields provide metadata to the document.These fields we don't need to populate. For example _timestamp which gives information when documents is indexed.Predefined fields always begin with _(underscore).

What is _ttl predefined field in Elasticsearch ?

_ttl means tile to live.It enables Elasticsearch to remove document after a specified time.

What is _source predefined field in Elasticsearch ?

_source predefined field lets to store original document in original format.Whenever we search any document ,we get this field by default.

How does Elasticsearch identify a document ?

Elasticsearch uses combination of type and id in _uid to identify a document uniquely in a same index._uid is used by Elasticsearch to identify document internally because Elasticsearch uses Lucene index and in Lucene there is no concept of type,type abstraction is provided by Elasticsearch. That is the reason in _uid both type and id of document is stored.

How document can be updated in Elasticsearch using cURL?

To understand updating of document in Elasticsearch, follow link

Elasticsearch updating example using curl

How does Elasticsearch maintain concurrency control ?

By version number for each document.If a document is indexed first time then its version number is 1 and if second time update happens then version number will be 2.In the meantime anyone update it then version conflicts and that update is cancelled.

What is close indices in Elasticsearch ?

A close index does not allow write and read operation and its data is not loaded in memory. We can restore it by opening index again.

Question on Search component

What is the query component in search request ?

This component configures best document to return based on its score.It is configured using query DSL or filter DSL.

What is size component in search request ?

This component configures amount of documents to return.

What is sort component in search request ?

This component configures in which order documents should be returned by default order is based on _score value in descending order.

What is _source component in search request ?

This component configures which fields should be returned in _source fields.By default all fields are returned.

What is from component in search request ?

This component configures from which page documents should be returned.This is used for pagination.For example if 40 items are calculated but we want from 20 documents then from will be 20.

What is the default size of the page in the response of search request ?


What is the difference between query and filter in Elasticsearch ?

Query calculates score based on matching so slower compared to filter in Elasticsearch. Filters are cacheable so if filters are used in another search then bitsets are not calculated again as behind the scene Elasticsearch does for filters.

What is the difference between match query and term query in Elasticsearch ?

match query analyze the input request and creates basic queries.For example if we search name:ABC then if any document has name=abe that also result of search while in term query exact match is done,it means abc will not be in output result.

What is character filtering ?

Character filtering transforms particular character to other character.For example convert & to and.

Explain Analyze API with an Example ?

To know about Analyze API with example visit below link.

Elasticsearch 6.0 Analyze API example

What is the default Analyzer in Elasticsearch for text ?


Mention few in built analyzer in Elasticsearch ?

  • Standard
  • Simple
  • WhiteSpace
  • Stop
  • Pattern
  • Keyword
  • SnowBall
  • language and MultiLingual

Mention few in built tokenizer in Elasticsearch ?

  • Standard
  • Letter
  • WhiteSpace
  • Lowercase
  • Pattern
  • Keyword
  • UAX URL Email
  • Path Hierarchy

Mention few in built token filter in Elasticsearch ?

  • Standard
  • Length
  • Lowercase
  • Stop
  • Reverse
  • ASCII Folding
  • Unique
  • Synonym

Visit Others Links

Interview Questions Top Elasticsearch Interview Question
Top Kubernetes Interview Question
Top HTTP Interview Question
Top PouchDB Interview Question
Top Pivotal Cloud Foundry (pcf) Interview Question
Top Apache Camel Interview Question
Top Docker Interview Question
Top Gradle Interview Question
Top Generics Interview Questions In Java
Java 9 Interview Questions
Top Maven Interview Question
Top RabbitMQ Interview Question
Top Spring Batch Interview Question
Top Spring Boot Interview Question
Top Tika Interview Question
Top Kotlin Interview Question
Top OpenShift Interview Question
Top Polymer Interview Question
Top WebGL Interview Question
Top Continuous Integration Interview Question
Top Spring Cloud Interview Question
Top JOGL Interview Question
Top JFreeChart Interview Question
Java MultiThreading Interview Question
Top Spring ROO Interview Question
Top Seaborn Interview Question
Top TestRail Interview Question
Top LolCode Interview Question
Top Spring Transaction Management Interview Question
Top DynamoDB Interview Question
Top PySpark Interview Question
Top SaltStack Interview Question
Top Spring AOP Interview Question
© 2019 PreparationForInterview.com