Security with Elasticsearch is mostly correct, boring defaults applied consistently. Here is the short list that removes most of the risk.
Safe defaults
- Enable security (TLS + auth); never expose 9200 publicly
- Use role-based access and API keys
Wire it into the pipeline
Provide Elasticsearch as a CI service.
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.15.0
env: { discovery.type: single-node, xpack.security.enabled: 'false' }
ports: ['9200:9200']Reinforcing habits
- Define explicit mappings; disable dynamic where possible
- Use Index Lifecycle Management for retention/rollover
- Size shards deliberately (tens of GB each)
Want senior help putting Elasticsearch to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.