This project aims to explore how NEST works with Elasticsearch in .NET 5 projects.
After the project clone follow the steps described in the installing.
HTTPS
git clone https://github.com/AntonioFalcao/Dotnet5.Elasticsearch.gitSSH
git clone [email protected]:AntonioFalcao/Dotnet5.Elasticsearch.git
- .NET 5 - The framework used
To check this functionality:
dotnet --versionFor more details
dotnet --info
- Docker - The container platform used
To check this functionality:
docker --version
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
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"
}
}
The respective compose provide the client
and stressor
services:
docker-compose up -d
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
- .NET 5 - The base framework used
- ASP.NET 5 - The web framework used
- AutoMapper - Library for mapping objects
- Elasticsearch - Search Engine used.
- NEST - Elasticsearch client for .NET
- Kibana - Elasticsearch visualize and analyze service
Available soon!
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Antônio Falcão - GitHub
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details
- Nothing more, for now.