Build your search engine with ElasticSearch (Part 1)

we will use in this article ElasticSearch which is a flexible and powerful open-source, distributed real-time search and analytics engine. Using a simple set of APIs, it provides the ability for full-text search. Elastic search is freely available under the Apache 2 license, which provides the most flexibility.

How ElasticSearch works :

Understanding Analysis in Elasticsearch (Analyzers)

Understanding the Inverted Index

the process of indexing(storing) documents

Install Elasticsearch on Linux

sudo apt-get install apt-transport-httpswget -qO — https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Then configure the apt repository on your Debian system. The below command will add a repository to install latest Elasticsearch 7.X on your Ubuntu system.

add-apt-repository “deb https://artifacts.elastic.co/packages/7.x/apt stable main”

After adding the repository to your system. Run the following commands to update cache and then install Elasticsearch packages on your system.

sudo apt-get updatesudo apt-get install elasticsearch

Configure Elasticsearch

sudo nano /etc/elasticsearch/elasticsearch.yml

Change the following values:

network.host: 0.0.0.0cluster.name: “myCluster1”node.name: “myNode1”http.port: 9200
  • network.host — Set the network host to 0.0.0.0 to listen on all interfaces and make it publically available. You can use your LAN address for LAN access only.
  • cluster.name — Name of the cluster. For the multi-node cluster, all the nodes must use the same cluster name.
  • node.name — Set the unique name of the node to identify in a cluster.

Launch Elasticsearch

sudo systemctl start elasticsearch.servicesudo systemctl stop elasticsearch.service

Install Kibana

Run the following command to install kibana package on your system

sudo apt-get install kibana

launch Kibana

sudo systemctl start kibana.service
sudo systemctl stop kibana.service

Connect to Kibana

your_server_ip : in local is localhost or 127.0.0.1

Finally you will see something like this :

Next Article:

The CRUD Operations

Computer science Engineer Student, A lover of everything that urges the mind to work hard such as Quantum Physics, General Medicine, Personal dev…

Computer science Engineer Student, A lover of everything that urges the mind to work hard such as Quantum Physics, General Medicine, Personal dev…