Aliases are lost after Elasticsearch Docker container recreate

Hello. Our project have Elasticsearch and Logstash running as Docker containers. Both started with one "docker-compose up" command. Containers config in "docker-compose.yaml" file. Elasticsearch successfully persists data using "volumes" option.

Sometimes we need to recreate Elasticsearch container (debug, maintenance or docker-compose.yaml changes). Indexes data is still here (volumes working). But Aliases to all indexes are lost.

My questions:

  1. Aliases don't have persistent storage as indexes?
  2. After container recreate is it ok aliases are cleared?

docker-compose.yaml

version: "3"
services:
  elasticsearch:
    image: elasticsearch:8.0.0
    container_name: sem_elasticsearch
    environment:
      - ELASTIC_PASSWORD=<ELASTIC_PASSWORD>
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=true
      - cluster.routing.allocation.disk.threshold_enabled=true
      - cluster.routing.allocation.disk.watermark.low=5gb
      - cluster.routing.allocation.disk.watermark.high=2gb
      - cluster.routing.allocation.disk.watermark.flood_stage=1gb
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - ./elasticsearch/config/hunspell:/usr/share/elasticsearch/config/hunspell:ro
      - ./volumes/elasticsearch:/var/lib/elasticsearch/data

  logstash:
    build:
      context: .
      dockerfile: Dockerfile-logstash
    container_name: sem_logstash
    depends_on:
      - elasticsearch
    environment:
      - ELASTICSEARCH_URL=http://elasticsearch:9200
      - ELASTIC_USER=elastic
      - ELASTIC_PASSWORD=<ELASTIC_PASSWORD>
      - DB_URL=<DB_URL
      - DB_USER=logstash
      - DB_PASSWORD=<DB_PASSWORD>
      - xpack.monitoring.enabled=false
    volumes:
      - ./logstash/pipeline/:/usr/share/logstash/pipeline/:ro
      - ./logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro
      - ./logstash/config/queries/:/usr/share/logstash/config/queries/:ro

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.