Everything You Need to Know About Elasticsearch

  • Real Estate: In real estate we often need to perform heavy searches on property listings, etc. as well as their details. Elasticsearch improves this search experience for end-users.
  • ECommerce: Websites need to perform heavy search on products as well as their listings. With Elasticsearch, you can improve search and optimize the order of displaying products.

Why choose Elasticsearch?

  1. Logging and log analysis
  • We can integrate logs of different applications like Apache, MySQL etc. Using the logs produced by these applications, we can then perform different analytics and enhance the system’s performance.
  • We can use it analyze system logs and then act depending on it.
  • In addition to existing firewalls, we can integrate it to the IDS (Intrusion Detection System).
  1. Due to a rest-based approach, Elasticsearch can be easily integrated with a system that can make API
  2. It also comes with an entire set of tools set (Logstash, Kibana, etc. ) making it more automated and convenient to use.
  1. Download and unzip where you want to place Elasticsearch
  2. Run bin/elasticsearch (or bin\elasticsearch.bat on Windows)
  3. Run curl http://localhost:9200/ or Invoke-RestMethod http://localhost:9200 with PowerShell
  4. Dive into the getting started guide and video.

Creating an Index

How to create Elasticsearch Index?

  • Employee is an index name against which we want to perform search.
  • Match is an operation that we are performing.
  • Name is filed name where we are searching for: Name=mark.

1. Match All Query -

2. Match None Query -

3. Full Text Queries -

  1. It is like search-as-you-type. Like the match phrase query, but does a wildcard search on the final word.
  2. {"query": {"match_phrase_prefix":{"message":"quick brown f"}}}

4. Term Level Queries -

5. Range Query -

  • gte − greater than equal to
  • gt − greater-than
  • lte − less-than equal to
  • lt − less-than

6. Compound Queries -

7. Geo Queries -

composer require -prefer-dist yiisoft/yii2-elasticsearch:”~2.1.0″

  • Match whole string using match phrase. This will help us finding the whole string in Documents.
  • If no data is found in above steps, then look from word match- each word from search string with or without condition. This will give all documents which has the relevant search words in the document.
  • If nothing is found in the above steps, then partial match of search words is done. This increases the space for finding results related to search documents.
  • Further, if nothing is found in above steps, then implement fuzziness in query. Fuzziness should be considered at end of search operation.

Data Analytics with Elasticsearch, Logstash & Kibana (ELK) -

  • Elasticsearch — It is mostly used for analyzing and indexing the data.
  • Logstash — It mainly collects logs and events from various sources. Then it transforms the data and sends to the Elasticsearch database.
  • Kibana — It’s an open-source visualization tool which gives a web interface to visualize Elasticsearch data. It helps us to create real-time dashboards. It also has multiple visualization effects like charts, graphs, tables, maps etc. with which we can save, edit, delete and share the dashboards.

Why is Log Analysis Becoming More Important? -

  1. Download Elasticsearch, Logstash & Kibana.
  2. Extract all the downloaded files.
  3. To setup on windows follow below steps -
  4. To start Elasticsearch
  5. Go to the <<Elasticsearch>>/bin and run elasticsearch.bat as an administrator.
  6. After starting Elasticsearch server check http://localhost:9200 in browser to confirm the startup.
  7. To start Kibana
  8. Go to the <<Kibana>>/bin and run kibana.bat as an administrator.
  9. After Kibana server is started check http://localhost:5601 in web browser.
  10. To start Logstash
  11. Go to the bin directory of Logstash and open command prompt as an administrator -
  12. When the main pipeline starts (“Pipeline main started”), type any message in the command prompt.




Software product development services company that builds world-class products & solutions by combining cutting-edge technologies for web, Cloud, data & devices

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nitor Infotech Private Limited

Nitor Infotech Private Limited

Software product development services company that builds world-class products & solutions by combining cutting-edge technologies for web, Cloud, data & devices

More from Medium

Starting My Data Journey

Into The Dataverse banner image

Learn Basics of Hadoop in easy Steps|Introduction to Hadoop

Building Machine Learning Pipeline on Azure

DevOps in Data Science