Elasticsearch – single node cluster with Docker

magnifying glass on white table

This example is only for development purposes!

docker run -d \
  --name=elastic \
  -p 0.0.0.0:9200:9200 \
  -p 0.0.0.0:9300:9300 \
  -e "discovery.type=single-node" \
  --restart=unless-stopped \
  docker.elastic.co/elasticsearch/elasticsearch:7.16.3

Test with cURL request:

curl -X GET 'http://IP:9200'

Should receive:

{
  "name" : "7ca5c260ab24",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "FV27yhVISOiGQboJAmAqDw",
  "version" : {
    "number" : "7.16.3",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "4e6e4eab2297e949ec994e688dad46290d018022",
    "build_date" : "2022-01-06T23:43:02.825887787Z",
    "build_snapshot" : false,
    "lucene_version" : "8.10.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Leave a Comment

Your email address will not be published.