question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] ECONNREFUSED connecting to localhost

See original GitHub issue
  • ElasticDump version - 6.82.3 through Docker container
  • Elasticsearch version - 6.2.4
  • Node.js version (note that nodejs v10+ is required for this tool) - 6.14.15
  • Full command you are having issue with (with inputs and outputs):
docker pull elasticdump/elasticsearch-dump

docker \
    run --rm -ti elasticdump/elasticsearch-dump \
    --input=https://prod.com/students \
    --output=http://localhost:9200/students \
    --searchBody="{\"query\": { \"geo_distance\": { \"distance\": \"4mi\", \"geolocation\": {\"lat\": 28.5384, \"lon\": -81.3789 } } } }" \
    --debug \
    --retryAttempts=5 \
    --type data

The above command results in the following error:

latest: Pulling from elasticdump/elasticsearch-dump
Digest: sha256:181435ce6b511b51ae2f60296469a3e1a34248948d151da665e25ba03756c1d9
Status: Image is up to date for elasticdump/elasticsearch-dump:latest
docker.io/elasticdump/elasticsearch-dump:latest
Wed, 08 Jun 2022 22:52:15 GMT | starting dump
Wed, 08 Jun 2022 22:52:15 GMT [debug] | discovered elasticsearch input major version: 6
Wed, 08 Jun 2022 22:52:34 GMT [debug] | lastScrollId: DnF1ZXJ5VGhlbkZldGNoAwAAAAAC9MQTFkZQVndPa0N2VHRhdThucDE5OUwtWFEAAAAAAtSkuxZWb3p5aU1ncVMzMjFoX1doRHZSSnpnAAAAAAL0xBIWRlBWd09rQ3ZUdGF1OG5wMTk5TC1YUQ==
Wed, 08 Jun 2022 22:52:34 GMT [debug] | Total Search Results: 3203
Wed, 08 Jun 2022 22:52:34 GMT | got 100 objects from source elasticsearch (offset: 0)
Wed, 08 Jun 2022 22:52:54 GMT | Error Emitted => connect ECONNREFUSED 127.0.0.1:9200
Wed, 08 Jun 2022 22:52:54 GMT | Error Emitted => connect ECONNREFUSED 127.0.0.1:9200
Wed, 08 Jun 2022 22:52:54 GMT | Total Writes: 0
Wed, 08 Jun 2022 22:52:54 GMT | dump ended with error (get phase) => Error: connect ECONNREFUSED 127.0.0.1:9200

But there is a elasticsearch running on localhost:

$ curl http://localhost:9200
{
  "name" : "RDEqfBO",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "SfUHE3LyTQKxWj3sxYZSFg",
  "version" : {
    "number" : "6.2.4",
    "build_hash" : "ccec39f",
    "build_date" : "2018-04-12T20:37:28.497551Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

When curl can connect to local ES, so should elasticdump.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
ferronrsmithcommented, Jun 9, 2022

Thanks for the note, i’ll update the docs. 👍🏾

0reactions
bsubburathinamcommented, Jun 9, 2022

That was it! Thanks @ferronrsmith

For future reference, --output had to be changed to use host’s DNS name. Like so:

--output=http://host.docker.internal:9200/students

Read more comments on GitHub >

github_iconTop Results From Across the Web

Localhost Refused to Connect Error: 5 Confirmed Ways to Fix It
Localhost refused to connect error can be caused by an incorrectly configured port, insufficient permissions, or an inoperative web server.
Read more >
ECONNREFUSED on running localhost server from NodeJS
My request looks as follows, using request : var options = { url: "http://localhost:50000", method: "GET" } request(options, function(error, ...
Read more >
Localhost Refused to Connect - How to Fix the Error
When developing locally the localhost refused to connect is the worst error you can get. See the causes and what solves the error....
Read more >
Step-by-Step Fix "ECONNREFUSED - Connection refused by ...
In this guide we show you how to resolve FileZilla's ECONNREFUSED - Connection refused by server error along with tips and tools that...
Read more >
Error: connect ECONNREFUSED 127.0.0.1:80 - Postman
It looks like you're sending a request to localhost:3000 , but your Proxy settings seem to be set to 127.0.0.1: 8080 Is your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found