# connectionError in ubuntu

**URL:** <https://discuss.elastic.co/t/connectionerror-in-ubuntu/51635>\
**Category:** Elasticsearch\
**Created:** [June 2, 2016, 1:40am UTC](https://discuss.elastic.co/t/connectionerror-in-ubuntu/51635 "2016-06-02T01:40:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jen](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@Jen](https://discuss.elastic.co/u/Jen)\
**Post date:** [June 2, 2016, 1:40am UTC](https://discuss.elastic.co/t/connectionerror-in-ubuntu/51635/1 "2016-06-02T01:40:59Z")

</div>

I installed docker on ubuntu and ran  
docker run -d -p 9200:9200 -p 5601:5601 nshou/elasticsearch-kibana  
so now I have Elasticsearch running as a container on docker.

I am using python and a module called Tweepy to insert data into elasticsearch like this:

`es.index(index="sentiment", doc_type="test-type", body={"author": dict_data["user"]["screen_name"], "favoriteCount": dict_data["favorite_count"], "tweetID": dict_data["id"], "lang": dict_data["lang"], "tweetID": dict_data["id"], "date": dict_data["created_at"], "message": dict_data["text"], "polarity": tweet.sentiment.polarity, "subjectivity": tweet.sentiment.subjectivity, "sentiment": sentiment})`

and I am running it. I want to download all the data to a csv file.

I found es2csv here [https://github.com/taraslayshchuk/es2csv](https://github.com/taraslayshchuk/es2csv)

Using ssh I tried this  
es2csv -q 'host: localhost' -o database.csv

but I get this:  
root@elk:~# es2csv -t dev -q 'host: localhost' -o database.csv  
ConnectionError(('Connection aborted.', BadStatusLine("''",))) caused by: ProtocolError(('Connection aborted.', BadStatusLine("''",)))

Using ssh I tried this  
es2csv -u 128.199.237.228:9200 -q '\*' -o database.csv

but I get this  
ConnectionError(\<urllib3.connection.HTTPConnection object at 0x7fb51b59d3d0\>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(\<urllib3.connection.HTTPConnection object at 0x7fb51b59d3d0\>: Failed to establish a new connection: [Errno 111] Connection refused)

Can anyone guess what the correct way to get this to work would be? I don't really understand networking and so I cannot figure out what these kinds of errors are.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 2, 2016, 3:25am UTC](https://discuss.elastic.co/t/connectionerror-in-ubuntu/51635/2 "2016-06-02T03:25:45Z")

</div>

FYI your cluster is exposed to the internet, you may want to redact your IP from the post.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:47pm UTC](https://discuss.elastic.co/t/connectionerror-in-ubuntu/51635/3 "2017-07-05T22:47:03Z")

</div>


