title: 'Connection refused' error trying to follow the Python Elasticsearch example usage
body: <p>I'm trying to run the 'example usage' script for <a href="https://elasticsearch-py.readthedocs.io/en/master/" rel="noreferrer">Python Elasticsearch</a>:</p>
  
  <pre><code>from datetime import datetime
  from elasticsearch import Elasticsearch
  es = Elasticsearch()
  
  doc = {
      'author': 'kimchy',
      'text': 'Elasticsearch: cool. bonsai cool.',
      'timestamp': datetime.now(),
  }
  res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
  print(res['created'])
  
  res = es.get(index="test-index", doc_type='tweet', id=1)
  print(res['_source'])
  
  es.indices.refresh(index="test-index")
  
  res = es.search(index="test-index", body={"query": {"match_all": {}}})
  print("Got %d Hits:" % res['hits']['total'])
  for hit in res['hits']['hits']:
      print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
  </code></pre>
  
  <p>However, I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "elasticsearch_example_usage.py", line 10, in &lt;module&gt;
      res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
    File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 69, in _wrapped
      return func(*args, params=params, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 279, in index
      _make_path(index, doc_type, id), params=params, body=body)
    File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 327, in perform_request
      status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
    File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py", line 105, in perform_request
      raise ConnectionError('N/A', str(e), e)
  elasticsearch.exceptions.ConnectionError: ConnectionError(&lt;urllib3.connection.HTTPConnection object at 0x7f0be9c14890&gt;: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(&lt;urllib3.connection.HTTPConnection object at 0x7f0be9c14890&gt;: Failed to establish a new connection: [Errno 111] Connection refused)
  </code></pre>
  
  <p>Can someone clarify why this doesn't work? Are there any additional commands I have to do to 'set up' Elasticsearch? The referenced website does not give any additional instruction or clarification.</p>