Getting Started with Elasticsearch in .NET - Part 1

 09-Jul-2017   nityaprakash     ElasticSearch    Comments  0

This post is explains about starting with Elasticsearch in .NET. It starts up with setting up the elastic search locally. Setting up Kibana to do locally to create regular tasks liken, creating indexes, understanding index creation, mapping (Schema), basic search. Elasticsearch is a highly scalable open-source full-text search and analytics engine. It allows you to store, search, and analyze big volumes of data quickly and in near real time.

Installing Elasticsearch in windows locally

Followings are the steps to install/Setup Elasticsearch locally:

  • Elasticsearch requires at least JAVA 8. Please make sure, if it is installed. Use below command to check the version. If it is not installed than go to Oracle Java link and download from there. Select windows 64 link to download.
    $ java -version
    $echo $JAVA_HOME
  • Go to Elasticsearch website and download .ZIP file.
  • Unzip the folder at the desired location. I prefer to have created C:\Elasticsearch folder and placed all files there.
  • Open command prompt and set C:\Elasticsearch your current folder.
  • Run batch file bin\elasticsearch.bat, it will start the elastic search on http://localhost:9200.
  • Go to browser and go to above url http://localhost:9200. It show below result, which indicated that service is up and running.
      "name" : "hbDXQIl",
      "cluster_name" : "elasticsearch_nityaprakash",
      "cluster_uuid" : "O9gcak8QSs2Emi_8nCJacQ",
      "version" : {
    "number" : "5.4.3",
    "build_hash" : "eed30a8",
    "build_date" : "2017-06-22T00:34:03.743Z",
    "build_snapshot" : false,
    "lucene_version" : "6.5.1"
    "tagline" : "You Know, for Search"

Alternatively, you can use below curl command in command prompt. Which will return similar response.

curl http://localhost:9200

Note: Curl utility by default is not installed on windows. It has to be installed separately.

Installing Elasticsearch on Mac.

It can be installed from Elasticsearch by downloading .tar file. But I prefer installing using Homebrew command which easy and straight forward.

  • Install the latest version of Homebrew. If it is already installed, than run below command to update the brew.
    $ brew update
  • Install Elasticsearch with command brew install elasticsearch. It will download the elastic search and install locally.
  • Run Elasticsearch by running elasticsearch command.
  • It can be test by above two ways mentioned previous section. Curl utility is by default available on mac.

Using Kibana

Kibana is an open source analytics and visualization platform designed to work with Elasticsearch. You use Kibana to search, view, and interact with data stored in Elasticsearch indices. You can easily perform advanced data analysis and visualize your data in a variety of charts, tables, and maps. **But I am going to use kibana's dev tool to create indices, data and search the data. Elasticsearch exposes the REST apis to perform these task and Kiban provides excellent tool to run those APIs. It also save the set command executed so working with API becomes easier.

Installing Kibana on Windows

  • Download Kibana as ZIP file from here.
  • Unzip the folder in required location.
  • Open kibana.yml file in text editor.
  • Uncomment the elasticsearch.url and set the elasticseach url `http://localhost:9200/'.
  • go to bin folder and run batch file kibana.bat file on command prompt. This will run the kibana on port 5601. You can Kibana with url http://localhost:5601. It will open the Kiban tool and we will select Dev Tools from last menu.

Installing Kibana on Mac

Installing on mac is lot easier than installing on windows. Homebrew is come to rescue here. It is as easier as installing elasticsearch. Followings are the steps.

  • Run brew install kibana command on terminal. It will install the kibana.
  • Open `kibana.yml' configuration file in text editor.
  • Uncomment the elasticsearch.url and set the elasticseach url `http://localhost:9200/'.
  • just run kibana command on terminal window. It will start the Kibana server at port 5601. * Open browser and go to url http://localhost:5601/.


This post list of steps to install the Elasticsearch and Kibana both on both prominent OS. Windows and Mac. Kibana is fantastic tool which provide the console dev tool which can used to call REST APIs to run the Elasticsearch methods. In next post we will go over basic concepts and commands of Elasticsearch.

Nitya Prakash Sharma has over 10 years of experience in .NET technology. He is currently working as Senior Consultant in industry. He is always keen to learn new things in Technology and eager to apply wherever is possible. He is also has interest in Photography, sketching and painting.

My Blog
Post Comment