Anything you do to Elasticsearch twice should be automated. This walks the path from a manual install to a repeatable, pipeline-driven setup.
1. Install it reproducibly
docker run -p 9200:9200 -e discovery.type=single-node \
-e xpack.security.enabled=false docker.elastic.co/elasticsearch/elasticsearch:8.15.02. Describe the desired state
Create an index with an explicit mapping.
curl -X PUT localhost:9200/logs -H 'Content-Type: application/json' -d '{
"mappings": { "properties": {
"@timestamp": { "type": "date" },
"level": { "type": "keyword" },
"message": { "type": "text" }
} }
}'3. Run it from CI
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']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.