Meet Elastic Seach (P1)

Tram Ho

Introducing Elastic Search

Elastic Search is an optimal database for searching. Elastic Search comes with Kibana, Logstash forming ELK Stack which is highly appreciated in the field of search engine, log. So this series of articles will help you get acquainted with this technology, starting from environment installation to code.

Install the environment

To simplify the installation process, I will install Elastic Search on docker. Create a docker network

Create the elaticsearch container.

Create a kibana container.

If you are familiar with docker then the two commands above are completely familiar. The simple explanation is that we will pull the elasticsearh image back to the machine, attach it to a network named elasticnet and expose port 9200 on the host machine, and the same is true of kibana.

From next time on, to run the environment, simply typing on the console is easy to start up elasticsearch and kibana.

Check if the container is running or not

It is successful if there are two containers, elasticsearch and kibana. Go to http: // localhost: 9200 to make sure Elastic Search server is up and running.

Manipulating with Elasticsearch on a kibana devtool.

Access to devtool on kibana: http: // localhost: 5601 / app / kibana # / dev_tools / console

Create an index named person (it can be considered creating a table in other databases). Note the lowercase index name.

Create a record on Elastic search with index person.


You can see that the record’s key field is _id. To update the record, use PUT.

The command to get all records


It can be seen that each record returned will have the score shown in the _score field, with this field we can see the match of the result with the search condition. In the case of all, _score equals 1.

The command searches for a field

In this case, we can clearly see, the first record has the highest score (because 2 words are identical with the search criteria, compared to the 2 records below, it is only 1). However, the scoring principle is based on many other factors that we will learn later in this article.


So we learned how to install Elastic Search in a development environment and some basic query commands through Devtool. Next time, we will learn how to integrate the NEST library (A library that makes Elastic Search accessible from C # easy) into the ASP .NET Core project.

Share the news now

Source : Viblo