elasticsearchpelias

pelias: error: elasticsearch not alive and version < 7.4.2 . But it seems alive and its version is 7.17.27


Executing raphy@WorldMap:~/pelias/schema$ ./bin/create_index I get two strange errors: Elasticsearch: No living connections and unsupported elasticsearch version. try: >=7.4.2 :

--------------
 create index 
--------------

Elasticsearch ERROR: 2025-06-13T11:35:38Z
  Error: Request error, retrying
  GET http://localhost:9200/ => connect ECONNREFUSED ::1:9200
      at Log.error (/home/raphy/pelias/schema/node_modules/elasticsearch/src/lib/log.js:239:56)
      at checkRespForFailure (/home/raphy/pelias/schema/node_modules/elasticsearch/src/lib/transport.js:298:18)
      at HttpConnector.<anonymous> (/home/raphy/pelias/schema/node_modules/elasticsearch/src/lib/connectors/http.js:171:7)
      at ClientRequest.wrapper (/home/raphy/pelias/schema/node_modules/lodash/lodash.js:4991:19)
      at ClientRequest.emit (node:events:517:28)
      at Socket.socketErrorListener (node:_http_client:501:9)
      at Socket.emit (node:events:517:28)
      at emitErrorNT (node:internal/streams/destroy:151:8)
      at emitErrorCloseNT (node:internal/streams/destroy:116:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Elasticsearch WARNING: 2025-06-13T11:35:38Z
  Unable to revive connection: http://localhost:9200/

Elasticsearch WARNING: 2025-06-13T11:35:38Z
  No living connections

NoConnections [Error]: No Living connections
    at sendReqWithConnection (/home/raphy/pelias/schema/node_modules/elasticsearch/src/lib/transport.js:266:15)
    at next (/home/raphy/pelias/schema/node_modules/elasticsearch/src/lib/connection_pool.js:243:7)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
unsupported elasticsearch version. try: >=7.4.2

But elasticsearch is alive:

raphy@WorldMap:~/pelias/schema$ curl http://localhost:9200/_cluster/health?pretty
{
  "cluster_name" : "pelias-dev",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 4,
  "active_shards" : 4,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0

raphy@WorldMap:~/pelias/schema$ sudo systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; preset: enabled)
     Active: active (running) since Fri 2025-06-13 13:28:36 CEST; 23min ago
       Docs: https://www.elastic.co
   Main PID: 2034685 (java)
      Tasks: 119 (limit: 31205)
     Memory: 10.6G (peak: 10.6G)
        CPU: 3min 41.657s
     CGroup: /system.slice/elasticsearch.service
             ├─2034685 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/share/elasticsearch/bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des>
             ├─2034756 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding>
             └─2034787 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Jun 13 13:27:44 WorldMap systemd[1]: Starting elasticsearch.service - Elasticsearch...
Jun 13 13:28:36 WorldMap systemd[1]: Started elasticsearch.service - Elasticsearch.

And elasticsearch version is 7.17.27 >> 7.4.2 :

raphy@WorldMap:~/pelias/schema$ curl -XGET 'http://localhost:9200'
{
  "name" : "7fb5c9ec8eb5",
  "cluster_name" : "pelias-dev",
  "cluster_uuid" : "LkFFt-94R1a89bE-CMrnug",
  "version" : {
    "number" : "7.17.27",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "0f88dde84795b30ca0d2c0c4796643ec5938aeb5",
    "build_date" : "2025-01-09T14:09:01.578835424Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.3",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"

Why does this happen? How to make it work?


Solution

  • This is a common networking issue, especially on systems where localhost resolves to the IPv6 loopback address (::1), but the server (Elasticsearch in this case) is only bound to IPv4 (127.0.0.1). That caused: connect ECONNREFUSED ::1:9200

    ✅ Fix: By switching from "host": "localhost" to "host": "127.0.0.1", you explicitly forced it to use IPv4, matching Elasticsearch’s bind address.

    🧪 Want to verify? You can check how localhost resolves on your system:

    If you see the following your system supports both, but preference is OS-dependent (e.g., Ubuntu prefers IPv6).

    ::1       localhost
    127.0.0.1 localhost
    

    Glad it’s working now!

    Musab Dogan