Giter VIP home page Giter VIP logo

dotnet5.elasticsearch's Introduction

.NET 5 + Elasticsearch + NEST

.NET Core

This project aims to explore how NEST works with Elasticsearch in .NET 5 projects.

Getting Started

After the project clone follow the steps described in the installing.

HTTPS

git clone https://github.com/AntonioFalcao/Dotnet5.Elasticsearch.git

SSH

git clone [email protected]:AntonioFalcao/Dotnet5.Elasticsearch.git

Prerequisites

To check this functionality:

dotnet --version

For more details

dotnet --info
  • Docker - The container platform used

To check this functionality:

docker --version

Installing

With the use of containerization, we can practically orchestrate the necessary infrastructure.

You will need an Elastic Search cluster + Kibana , to meet the need for Search Engine, so you must run the respective docker-compose on your Elasticsearch server.

cd ./.elasticsearch/
docker-compose up -d

Is important to say, if occurrence problems with max virtual memory area:

docker logs es01

# abbreviated

ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

It's possible to increase to at least [262144]:

sudo sysctl -w vm.max_map_count=262144

More details about in this link

The Kibana service will be available in default host http://localhost:5601, as defined on compose.

  kib01:
    image: docker.elastic.co/kibana/kibana:7.6.0
    container_name: kib01
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_URL: http://es01:9200
      ELASTICSEARCH_HOSTS: http://es01:9200

# abbreviated

App settings

After providing the necessary infrastructure, we need to define the cluster index and nodes addresses on the appsettings from the Elasticsearch.Client.WebApi project.

{
  "Elasticsearch": {
    "index": "card",
    "node1Uri": "http://192.168.0.27:9200/",
    "node2Uri": "http://192.168.0.27:9201/",
    "node3Uri": "http://192.168.0.27:9202/"
  }
}

And then set the HTTP client host on appsettings from Elasticsearch.Stressor.WebApi project.

{
  "ElasticsearchClient": {
    "Url": "http://localhost:5000"
  }
}

Running

The respective compose provide the client and stressor services:

docker-compose up -d

Stressor and Client services

The Stressor service provide resources to request generate, modify, and remove data from Elasticsearch through the client service.

Is just run the compose from the app to up both of then in the same network. In this way is possible to use services names on the appsettings.

The Client routing uses the default http://hostname:port/api/v{version}/controller,
where /v1 is Synchronous and /v2 is Asynchronous.

The Stressor routing uses the default http://hostname:port/controller/action.

To make API calls, you can use the file ./basic-api-call.http through extension REST Client:

# STRESSOR
###
GET http://localhost:6000/stressor/generate?amount=10
###
GET http://localhost:6000/stressor/modify?amount=10
###
GET http://localhost:6000/stressor/exclude?amount=10
# CLIENT
###
GET http://localhost:5000/api/v2/card
###
GET http://localhost:5000/api/v2/card/f694491b-bc98-45bc-af97-67f7ac460908

Built With

.NET Stack

Elasticsearch Stack

  • Elasticsearch - Search Engine used.
  • NEST - Elasticsearch client for .NET
  • Kibana - Elasticsearch visualize and analyze service

Contributing

Available soon!

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Nothing more, for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.