Getting Started Elasticsearch using Elastic.Clients.Elasticsearch

 

Prerequisite: This demo requires Visual Studio CodeVisual Studio Express, and Docker for Windows. Please download and install the required software on your machine if needed.

Introduction

The NEST client was officially deprecated starting with version 8.13 and will reach its end-of-life by the end of the year. Developers should begin migrating to Elastic.Clients.Elasticsearch to avoid any disruptions.

Why the Change?

1. Simplified Codebase: The new client, Elastic.Clients.Elasticsearch, was completely redesigned to make it easier to maintain and develop.

2. Automatic Code Generation: Instead of manually managing Elasticsearch’s huge API (over 450 endpoints and nearly 3000 types), the new client uses automatic code generation. This ensures the client is always up-to-date and aligned with the Elasticsearch server.

3. Better Long-Term Support: Manually maintaining such a vast API had become unsustainable. The new approach focuses on maintainability and consistency, making it easier to manage updates and new features.

4. Future-Proof Your Applications: Migrating to Elastic.Clients.Elasticsearch ensures compatibility with the latest server features and reduces risks from outdated or deprecated functionality.

In short, upgrading to Elastic.Clients.Elasticsearch will simplify your code, ensure long-term support, and keep your applications ready for the future.

Setup ELK stack on docker

This project has dependencies of the ELK stack running in the docker environment. To deploy the ELK stack clone repository 

git clone https://github.com/vizsphere/ELK_Docker

Open the VS code, click the terminal, and run the docker-compose command.

docker-compose up

The first time, pulling images and running services may take a few minutes. Let’s check if the services are running in the docker. 

docker ps –filter “name=elasticsearch” –filter “name=kibana” –filter “name=logstash”

 Docker-ServicesAt this point, you should be able to view running services in the browser

Elasticsearch http://localhost:9200

Logstash http://localhost:9600

Kibana http://localhost:5601

Elastic.Clients.Elasticsearch

This standard .NET MVC project serves as a comprehensive demonstration of integrating the New York City Airbnb Open Data. The project begins by utilizing a sample CSV dataset containing Airbnb listings, ingested into Elasticsearch through Logstash during the initial dependency setup. This automated ingestion process ensures the Elasticsearch index is pre-populated with sample data, allowing the application to be fully functional upon initialization.

The application is designed to showcase essential features for interacting with the dataset, including Create, Read, Update, and Delete (CRUD) operations. These capabilities enable users to manage Airbnb listing data directly within the application interface. Additionally, it provides data filtering functionality, empowering users to explore and analyze the dataset effectively. For example, users can filter listings based on attributes like price, neighborhood, or property type, enhancing the application’s usability for real-world data analysis scenarios.

By combining .NET MVC, Elasticsearch, and Logstash, this project illustrates the seamless integration of backend data processing with a user-friendly web interface, making it a valuable tool for learning and demonstrating modern software development and data management practices.