schon/scripts/Windows/delete-elasticsearch.ps1
Egor fureunoir Gorbunov 304608adc4 feat(elasticsearch): add scripts for cleaning Elasticsearch data
Introduce `delete-elasticsearch` scripts for both Windows and Unix to stop, remove containers, and delete data volumes. Updated `Makefile` to include this command for easier management. Upgraded `django-elasticsearch-dsl` and related dependencies to their latest versions for compatibility.

Breaking change: Updated Elasticsearch image and configuration to enable xpack security. Ensure environment variables are properly set.
2026-03-03 01:44:51 +03:00

38 lines
1.2 KiB
PowerShell

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
# Load shared utilities
$utilsPath = Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) '..\lib\utils.ps1'
. $utilsPath
.\scripts\Windows\starter.ps1
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
# Stop the elasticsearch container
Write-Step "Stopping Elasticsearch container..."
docker compose stop elasticsearch
if ($LASTEXITCODE -ne 0) {
Write-Warning-Custom "Elasticsearch container may not be running"
}
Write-Success "Elasticsearch container stopped!"
# Remove the elasticsearch container
Write-Step "Removing Elasticsearch container..."
docker compose rm -f elasticsearch
if ($LASTEXITCODE -ne 0) {
Write-Warning-Custom "Failed to remove Elasticsearch container"
}
Write-Success "Elasticsearch container removed!"
# Remove the es-data volume
Write-Step "Removing Elasticsearch data volume..."
docker volume rm -f schon_es-data
if ($LASTEXITCODE -ne 0) {
Write-Warning-Custom "Failed to remove es-data volume (may not exist)"
}
Write-Success "Elasticsearch data volume removed!"
Write-Result ""
Write-Result "Elasticsearch has been wiped. Run 'make restart' to recreate and reindex."