title: TransportError: TransportError(503, 'search_phase_execution_exception')
body: <p>I'm trying to read documents from an index using Python with Elasticsearch. I get an error I can't find the solution to. Does anyone know how I can fix this?</p>
  <p>I've looked online for the same problem, but I can't find any related articles/solutions.</p>
  <p>This is my code:</p>
  <pre><code>from elasticsearch import Elasticsearch
  from pandasticsearch import Select
  
  # Connection to ElasticSearch
  es = Elasticsearch(['http://localhost:9200'],timeout=600)
  
  # Retrieving all documents in index (no query given)
  documents = es.search(index='myindex',body={&quot;query&quot;: {&quot;match_all&quot;: {}}})
  
  # Convert the result to Pandas Dataframe
  pandas_df = Select.from_dict(documents).to_pandas()
  </code></pre>
  <p>*Source: <a href="https://medium.com/@patni.sonal/elasticsearch-convert-your-index-data-into-pandas-dataframe-30c44ada2407" rel="nofollow noreferrer">https://medium.com/@patni.sonal/elasticsearch-convert-your-index-data-into-pandas-dataframe-30c44ada2407</a></p>
  <p>The error I get is:</p>
  <pre><code>GET http://localhost:9200/myindex/_search [status:503 request:0.062s]
  GET http://localhost:9200/myindex/_search [status:503 request:0.027s]
  GET http://localhost:9200/myindex/_search [status:503 request:0.030s]
  GET http://localhost:9200/myindex/_search [status:503 request:0.017s]
  Traceback (most recent call last):
  
  File &quot;&lt;ipython-input-6-68e07be7c100&gt;&quot;, line 1, in &lt;module&gt;
  documents = es.search(index='myindex',body={&quot;query&quot;: {&quot;match_all&quot;: {}}})
  
  File &quot;C:\Users\XXXXXX\AppData\Local\Continuum\anaconda3\lib\site- 
  packages\elasticsearch\client\utils.py&quot;, line 76, in _wrapped
  return func(*args, params=params, **kwargs)
  
  File &quot;C:\Users\XXXXXX\AppData\Local\Continuum\anaconda3\lib\site- 
  packages\elasticsearch\client\__init__.py&quot;, line 655, in search
  doc_type, '_search'), params=params, body=body)
  
  File &quot;C:\Users\XXXXXX\AppData\Local\Continuum\anaconda3\lib\site- 
  packages\elasticsearch\transport.py&quot;, line 318, in perform_request
  status, headers_response, data = connection.perform_request(method, url, 
  params, body, headers=headers, ignore=ignore, timeout=timeout)
  
  File &quot;C:\Users\XXXXXX\AppData\Local\Continuum\anaconda3\lib\site- 
  packages\elasticsearch\connection\http_urllib3.py&quot;, line 185, in 
  perform_request
  self._raise_error(response.status, raw_data)
  
  File &quot;C:\Users\XXXXXX\AppData\Local\Continuum\anaconda3\lib\site- 
  packages\elasticsearch\connection\base.py&quot;, line 125, in _raise_error
  raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, 
  error_message, additional_info)
  
  TransportError: TransportError(503, 'search_phase_execution_exception')
  </code></pre>
  <p>This is the elasticsearch log:</p>
  <pre><code>[2019-04-25T11:19:35,843][DEBUG][o.e.a.s.TransportSearchAction] [Cx6mYd6] All shards failed for phase: [query]
  [2019-04-25T11:19:35,845][WARN ][r.suppressed             ] [Cx6mYd6] path: /myindex/_search, params: {index=myindex}
  org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
      at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:293) ~[elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:133) ~[elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:254) ~[elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.action.search.InitialSearchPhase.onShardFailure(InitialSearchPhase.java:101) ~[elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.action.search.InitialSearchPhase.lambda$performPhaseOnShard$1(InitialSearchPhase.java:209) ~[elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.action.search.InitialSearchPhase$1.doRun(InitialSearchPhase.java:188) [elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:759) [elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) [elasticsearch-6.6.1.jar:6.6.1]
      at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.6.1.jar:6.6.1]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_181]
      at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
  </code></pre>
  <p>Does anyone has any idea on how to fix this?</p>