How to Create a Full Autocomplete Search Application with Elasticsearch and NestJs – Part 2

how-to-create-a-full-autocomplete-search-application-with-elasticsearch-and-nestjs-–-part-2

Hello and welcome back to the part 2 of this series, in the previous article, I showed you how to setup and configure elasticsearch on your PC, in case you missed it, no worries, check it out here.

In this article, I will be walking you through how to setup and connect to elasticsearch through Kibana and NestJs application to create a backend server.

Hold up, what is Kibana?

Kibana is a source-available data visualization dashboard software for Elasticsearch, whose free and open source successor in OpenSearch is OpenSearch Dashboards. Read more

How does Kibana help us in this case you may ask?

Kibana is a great visualization tool that helps us with our elasticsearch queries and manipulation. It is part of B.E.L.K (Beats, Elasticsearch, Logstash and Kibana) stack. In case you don’t know much about it, follow along and you will be just fine! (A separate article on Kibana can be written as an addendum to this series if you want, let me know in the comment section!)

Setting up and Configuring Kibana

In order to download Kibana, goto Kibana Download Page, click on the download button.
Download Kibana

After downloading, extract the zip file using this command

$ tar -xzvf kibana-8.4.1-darwin-aarch64.tar.gz
$ cd kibana-8.4.1

There are two ways to configure and connect Kibana to elasticsearch, one way is to manually input the required keys into kibana.yml (in config/kibana.yml) or run Kibana and configure on the UI. I’m choosing the latter 😉!

Run kibana using this command:

bin/kibana

When starting Kibana for the first time, you will be presented with this screen

kibana enrolment

There are two ways to tackle this;

  1. Use the elastic enrollment token (usually generated on your terminal when starting elastic for the first time) see below;

elastic enrolment

Copy and paste the enrollment token above to Kibana and click Configure Elastic. You will be fine

  1. Manually configure Kibana with elastic using the elastic URL. Click on check address and click Configure elastic.

elastic url

Enter kibana_system password generated. Or click forgot password (if you can not recall the password), paste the command below to your terminal to reset the password.

bin/elasticsearch-reset-password --username kibana_system

You will be asked to enter a verification code, check your terminal (where you are running kibana to retrieve it)

verification code

That’s it! You are all set up.

Enter your elastic username and password to login to kibana and you are in!

elastic login

Querying elastic using Kibana

Let’s run a sample query to test our connection, shall we?

  1. Click on the hamburger (three lines on the top left corner of your screen)
  2. Scroll down to the bottom of the page
  3. Click on Dev tools

You should see something like this:
dev tools
On the left pane is where queries are written, the right pane is where the outputs are presented.

Ensure you click on any part of the query and select the play button.

The output of the query will be presented on the right pane.

Summary

In this article, we are able to connect successfully to elasticsearch and run sample queries using Kibana.

In the next article, I will show you how to Import data to elastic using Kibana and walk you through how to use the imported data in your NestJS application.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
advantages-and-disadvantages-of-next.js

Advantages and disadvantages of Next.js

Next Post
top-6-heroku-alternatives

Top 6 Heroku alternatives

Related Posts
役員変更登記

役員変更登記

2025-05-08 申請用総合ソフトで行う アカウントは個人で OK(法人用は特にない) 登記申請書(法人等用)を使う 参考 https://www.touki-kyoutaku-online.moj.go.jp/toukinet/taiken/taiken_zeninjuunin.html https://houmukyoku.moj.go.jp/homu/shogyo_online03.html 法人番号で検索した住所のハイフンが外字扱いだったので、直接入力に切り替えて入力した 電話がかかってきて以下のような文言修正を要求された 添付ファイルに電子署名が必要 議事録の「第 2 号議案:代表理事の重任について」を「第 2 号議案:理事及び代表理事の重任について」 同様に「任期満了に伴い、鈴木健志を理事及び代表理事に再任することを決議した。」 「なお席上就任を承諾した。」の文言を追加。同意書なしのため必要らしい。…
Read More