title: Elasticsearch - NotFoundError: NotFoundError(404, 'index_not_found_exception', 'no such index)
body: <p>I am trying to retrieve documents from an elastisearch index using python. The code for which is below:</p>
  
  <pre><code>def get_data_es():
      ES_HOST = {
              "host": "localhost",
              "port": 9200
              }
  
      ES_INDEX = "radius_ml_posts"
      ES_TYPE = {'author': 'vaibhav'}
  
      es = Elasticsearch(hosts=[ES_HOST,])
      count = 0
      while True:
          try:
              es.ping()
              print("Elasticsearch server bounded at url: {}".format(es.cat.master().split()[-2]))
              results_gen = elasticsearch.helpers.scan(
                  es,
                  query={"query": {"match_all": {}}},
                  index=ES_INDEX
              )
              break
          except elasticsearch.exceptions.ConnectionError:
              time.sleep(15)
              count += 1
              print("Trying to connect to elasticsearch server. Retry number: {}".format(count))
              print("Connections info: {}".format(es.transport.connection_pool.connections))
      return list(results_gen)
  </code></pre>
  
  <p>When I call this function I get the following error:</p>
  
  <pre><code>data = get_data_es()
  Elasticsearch server bounded at url: 172.29.0.3
  Traceback (most recent call last):
  
    File "&lt;ipython-input-39-cd0614623725&gt;", line 1, in &lt;module&gt;
      data = get_data_es()
  
    File "&lt;ipython-input-38-af72b83dd516&gt;", line 27, in get_data_es
      return list(results_gen)
  
    File "/opt/anaconda3/lib/python3.7/site-packages/elasticsearch/helpers/actions.py", line 445, in scan
      body=query, scroll=scroll, size=size, request_timeout=request_timeout, **kwargs
  
    File "/opt/anaconda3/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 92, in _wrapped
      return func(*args, params=params, headers=headers, **kwargs)
  
    File "/opt/anaconda3/lib/python3.7/site-packages/elasticsearch/client/__init__.py", line 1627, in search
      body=body,
  
    File "/opt/anaconda3/lib/python3.7/site-packages/elasticsearch/transport.py", line 362, in perform_request
      timeout=timeout,
  
    File "/opt/anaconda3/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 252, in perform_request
      self._raise_error(response.status, raw_data)
  
    File "/opt/anaconda3/lib/python3.7/site-packages/elasticsearch/connection/base.py", line 282, in _raise_error
      status_code, error_message, additional_info
  
  NotFoundError: NotFoundError(404, 'index_not_found_exception', 'no such index [radius_ml_posts]', radius_ml_posts, index_or_alias)
  </code></pre>
  
  <p>I checked the elasticsearch server and the index itself. They are all up and running fine. </p>
  
  <p>The version of elasticsearch in python is '7.7.0'.</p>
  
  <p>Can you please help in fixing this?</p>