Elasticsearch implemented in ASP.NET Core Web API for learning purposes. WIP.
There are many ways to do this, I decided to install Elasticsearch with Docker and run a single-node cluster for testing purposes. I use Windows with Rancher Desktop and WSL2.
By default, many systems set vm.max_map_count to 65530, which is often too low for Elasticsearch. It's recommended to set vm.max_map_count to at least 262144 for Elasticsearch to function properly.
- Open a WSL2 terminal
- Increase the vm.max_map_count:
sysctl -w vm.max_map_count=262144
- Verify it was set correctly:
sysctl vm.max_map_count
- Pull image:
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.8.0
- Create Docker network:
docker network create elastic
- Start container:
docker run --name es01 -m 4GB -p 9200:9200 -it docker.elastic.co/elasticsearch/elasticsearch:8.8.0
After running the above commands, Elasticsearch service is accessible on port 9200 on the host machine (https://localhost:9200). A user with the username elastic will be created automatically and the password will be output to the console on start. A HTTP CA certificate SHA-256 fingerprint will also be output console on start.
"ElasticsearchOptions": {
"Url": "Environment-specific",
"FingerPrint": "Environment-specific/secret",
"Username": "Environment-specific/secret",
"Password": "Environment-specific/secret"
}