From 809020b362af4a56b2d5d64e06ea509fca6bd5dd Mon Sep 17 00:00:00 2001 From: Jakub Date: Sat, 12 Aug 2023 20:27:16 +0200 Subject: [PATCH] Add command to clean elasticsearch --- Makefile | 9 ++++++ README.md | 91 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index 71940f6..fd96e4f 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,15 @@ install-helm-readme: helm-readme: ./scripts/generate_helm_readme.sh +#: Cleans Elasticsearch data, works only with default ES port. The command may take a very long time to complete +clean-elasticsearch: + @indices=$(shell curl -s -X GET "http://localhost:9200/_cat/indices" | awk '{print $$3}') ;\ + for index in $$indices ; do \ + echo "Deleting all documents from index $$index" ;\ + curl -X POST "http://localhost:9200/$$index/_delete_by_query?conflicts=proceed" -H "Content-Type: application/json" -d '{"query": {"match_all": {}}}' ;\ + echo "" ;\ + done + #: Shows info about available commands help: @grep -B1 -E "^[a-zA-Z0-9_-]+\:([^\=]|$$)" Makefile \ diff --git a/README.md b/README.md index 6a2661b..2d29546 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ All configuration variables can be checked in the [config directory](./config/). #### Available Commands - + - `make all`: Builds binary executables for all OS (Win, Darwin, Linux). - `make run`: Runs the Go Exporter application. - `make build-linux`: Builds a binary executable for Linux. @@ -124,8 +124,9 @@ All configuration variables can be checked in the [config directory](./config/). - `make minify`: Minifies the binary executables. - `make install-helm-readme`: Installs readme-generator-for-helm tool. - `make helm-readme`: Generates Helm chart README.md file. +- `make clean-elasticsearch`: Cleans Elasticsearch data, works only with default ES port. The command may take a very long time to complete. - `make help`: Shows info about available commands. - + #### File Structure @@ -136,87 +137,91 @@ The binary executables are saved in the out directory. #### Example Usage - + Builds binary executables for all OS (Win, Darwin, Linux): - + make all - + Runs the Go Exporter application: - + make run - + Builds a binary executable for Linux: - + make build-linux - + Builds a binary executable for Darwin: - + make build-darwin - + Builds a binary executable for Windows: - + make build-windows - + Builds a Docker image for the Go Exporter application: - + make build-docker - + Builds a multi-arch Docker image (`amd64` and `arm64`): - + make build-docker-multi - + Deletes all binary executables in the out directory: - + make clean - + Runs all tests: - + make test - + Displays test coverage report: - + make test-coverage - + Starts a Docker-compose configuration: - + make compose - + Starts a Docker-compose configuration until it's ready: - + make wait-for-compose - + Stops a Docker-compose configuration: - + make compose-down - + Verifies the metrics from the Go Exporter application: - + make verify-metrics - + Pulls the Docker image from the registry: - + make pull - + Shows logs from the Docker-compose configuration: - + make logs - + Minifies the binary executables: - + make minify - + Installs readme-generator-for-helm tool: - + make install-helm-readme - + Generates Helm chart README.md file: - + make helm-readme - + +Cleans Elasticsearch data, works only with default ES port. The command may take a very long time to complete: + + make clean-elasticsearch + Shows info about available commands: - + make help - + ## Helper Scripts