← All insightsBest Practices

Elasticsearch best practices for teams

Nir Geier, CodeWizard · 11 August 2025 · 3 min read · Intermediate

Elasticsearch rewards a little discipline. These are the practices that keep it maintainable as a team and a codebase grow.

The practices

  • Define explicit mappings; disable dynamic where possible
  • Use Index Lifecycle Management for retention/rollover
  • Size shards deliberately (tens of GB each)

What good looks like

Create an index with an explicit mapping.

bash
curl -X PUT localhost:9200/logs -H 'Content-Type: application/json' -d '{
  "mappings": { "properties": {
    "@timestamp": { "type": "date" },
    "level": { "type": "keyword" },
    "message": { "type": "text" }
  } }
}'

Anti-patterns to retire

  • Unbounded mapping explosion from dynamic fields
  • Too many small shards hurting performance
  • No ILM, so indices grow without retention

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.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult