Distributed search engine for full-text search and analytics.
Installation¶
docker run -d --name es -p 9200:9200 \
-e discovery.type=single-node \
-e xpack.security.enabled=false \
elasticsearch:8.12.0
curl localhost:9200
Operations¶
curl -X PUT localhost:9200/articles
curl -X POST localhost:9200/articles/_doc \
-H 'Content-Type: application/json' \
-d '{"title":"ES tutorial","tags":["search"]}'
curl localhost:9200/articles/_search?q=tutorial
Cluster Configuration¶
For production deployments, run Elasticsearch as a cluster with at least three nodes to ensure high availability. Each index should have replicas for data redundancy. Set discovery.seed_hosts and cluster.initial_master_nodes for proper cluster initialization.
Elasticsearch stores data in inverted indexes, enabling extremely fast full-text search. When creating an index, define the mapping explicitly — dynamic mapping works for prototypes, but in production it can lead to unexpected field types and wasted memory. For cluster monitoring, use Kibana or the Elasticsearch API endpoint _cluster/health. Pay particular attention to the number of unassigned shards and JVM heap usage.
Elasticsearch for Search¶
Full-text search, log analytics, dashboards.