受欢迎的博客标签

Running Elasticsearch 7.x on Ubuntu 18.04 with .NET NEST step by step

Published

In this tutorial, we will show you how to install Elasticsearch on Ubuntu 18.04。The easiest way to install Elasticsearch on Ubuntu 18.04 is by installing the deb package from the official Elasticsearch repository.So Let's follow these steps to configure and use Elasticsearch

step 1:Install OpenJDK on Ubuntu 18.04

To Install and configure Elasticsearch, we need to Install JRE. You can download it from here.

https://www.iaspnetcore.com/blog/blogpost/5e0ca8912328b1510a07e5c3/elasticsearch-on-ubuntu2-install-openjdk

 

step 2:install Elasticsearch on Ubuntu 18.04 

Once you download and install JRE, you need to download the setup Elasticsearch and install it from below link.

https://www.elastic.co/downloads/elasticsearch

official Elasticsearch Document:Install Elasticsearch with Debian Package

https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html

 

Step 3

Once you install Elasticsearch, check whether Elasticsearch is installed or not by hitting below url in any browser.

wget http://localhost:9200/

step 4: Install IK Analysis for Elasticsearch on Ubuntu 18.04 

IK Analysis for Elasticsearch

https://github.com/medcl/elasticsearch-analysis-ik

 

https://www.iaspnetcore.com/blogpost-5e0cb4d02328b1510a083038-elasticsearch-on-ubuntu6-install-ik-analysis-for-elasticsearch-7x-on-ubuntu

https://www.iaspnetcore.com/blog/blogpost/5933ab8484cd452fecab6c71/elastic-search-521-search-engine-framework-installation-and-configuration-on-linux-and-analysis-ik-chinese-word-segmentation-plug-in-installation

 

 

 

https://linuxize.com/post/how-to-install-elasticsearch-on-ubuntu-18-04/

Working On ElasticSearch Using .NET NEST step by step

 

 

 

Step 5

Create a WebSolution or WebAPI to do the operations on Elasticsearch. Add nuget package of NEST for .NET.

Either take it from this link https://www.nuget.org/packages/NEST/ OR Use Install-Package NEST -Version 6.5.0

Now you are ready to work on Elasticsearch through .NET.

Now follow the below steps to proceed further:

Step 6

Add Namespace in your Controller. This will give you facility to connect with your Elasticsearch instance from your .Net code.

 

 
  1. using Nest;  

Here points to note is that "index" is Database and "type" is Table. so you need to create INDEX(Database) first, then you need to create TYPE(Table) so that you can insert data in table in the format of JSON.

Step 7

Please add the below code to connect and create index, type and insert data in it. I have created a complete API as a sample for your reference. Below code is in working state.
 

 

ElasticSearch web Api site for books market with ElasticSearch.Net and Asp .Net core

https://github.com/freemsly/WebMarket