version: "3"

services:
  elasticsearch:
    image: elasticsearch:8.13.0
    environment:
      - action.destructive_requires_name=false  # allow wildcard index deletions
      - discovery.type=single-node
      - xpack.license.self_generated.type=trial
      - xpack.security.enabled=false  # disable password and TLS; never do this in production!
    ports:
      - "9200:9200"
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "curl --silent --fail http://localhost:9200/_cluster/health || exit 1"
        ]
      interval: 10s
      retries: 60

  # Currently fails on Mac: https://github.com/elastic/elasticsearch/issues/106206
  elasticsearch-with-model:
    image: docker.elastic.co/eland/eland
    depends_on:
      - elasticsearch
    restart: no
    command: sh -c "
      sleep 10 &&
      eland_import_hub_model \
        --hub-model-id sentence-transformers/all-minilm-l6-v2 \
        --url http://elasticsearch:9200 \
        --start
      "
