Showing posts with label Elastic Search Interview Questions. Show all posts
Showing posts with label Elastic Search Interview Questions. Show all posts

April 17, 2020

Part 6: Elastic Search Interview Questions And Answers(Hands On)

Explain Bool Query in ElasticSearch.
A query that matches documents matching boolean combinations of other queries is called Bool Query. It is built using one or more boolean clauses, each clause with a typed occurrence. 

  • must: The clause (query) must appear in matching documents and will contribute to the score.
  • filter: The clause (query) must appear in matching documents. However unlike must the score of the query will be ignored. Filter clauses are executed in filter context, meaning that scoring is ignored and clauses are considered for caching.
  • should: The clause (query) should appear in the matching document.
  • must_not: The clause (query) must not appear in the matching documents. Clauses are executed in filter context meaning that scoring is ignored and clauses are considered for caching. Because scoring is ignored, a score of 0 for all documents is returned.

What is the difference between MUST and SHOULD bool query?
must means: The clause (query) must appear in matching documents. These clauses must match, like logical AND.
should means: At least one of these clauses must match, like logical OR.

In other words, results will have to be matched by all the queries present in the must clause or match at least one of the should clauses if there is no must clause.

What is the difference between MUST and FILTER bool query?
The must contributes to the score. In filter, the score of the query is ignored.

In both must and filter, the clause(query) must appear in matching documents. This is the reason for getting same result.

Examples:
To get list of all the bank accounts, execute:
GET bank/account/_search

To get all the bank acconuts from California (State will be CA):
GET bank/account/_search
{
  "query": {
    "match": {"state": "CA"}
  }
}

To get all the bank acconuts of Techade from California (State will be CA)
GET bank/account/_search
{
  "query": {
    "bool": {
      "must": [
        { "match": {"state": "CA"} },
        { "match": {"employer": "Techade"}}
      ]
    }
  }
}

To get all the bank acconuts not from Techade and outside California (State will be CA)
GET bank/account/_search
{
  "query": {
    "bool": {
      "must_not": [
        { "match": {"state": "CA"} },
        { "match": {"employer": "Techade"}}
      ]
    }
  }
}

-K Himaanshu Shuklaa..

Part 5: Elastic Search Interview Questions And Answers(Hands On)

How to check health of cluster and node?
Start ElasticSearch and Kibana, and then open Kibana dashboard (you can open it with this URL  http://localhost:5601/app/kibana#/dev_tools/console)

to check health of cluster execute:
GET _cat/health?v

April 16, 2020

Part 4: Elastic Search Interview Questions And Answers

What is ELK Stack and its contents?
Enterprises, large or small nowadays come across information in the form of reports, data and customer follow-ups and historical, current orders as well as customer reviews from the online and offline logs. It is essential to store and analyze these logs which will help predict valuable feedback for the businesses.

Part 3: Elastic Search Interview Questions And Answers

What is an Elasticsearch Analyzer? What are the various types of analyzers in Elasticsearch?
Analyzers are used for Text analysis, it can be either built-in analyzer or custom analyzer.

The analyzer consists of zero or more character filters, at least one Tokenizer and zero or more Token filters.

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.

Part 1: Elastic Search Interview Questions And Answers

Explain in brief about Elasticsearch?
Elasticsearch is an open-source, RESTful, scalable, built on Apache Lucene library, document-based search engine. It stores retrieve and manage textual, numerical, geospatial, structured and unstructured data in the form of JSON documents using CRUD REST API or ingestion tools such as Logstash.