# TransportError(503, 'search\_phase\_execution\_exception') only while using python but not in kibana?

**URL:** <https://discuss.elastic.co/t/transporterror-503-search-phase-execution-exception-only-while-using-python-but-not-in-kibana/301164>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [March 31, 2022, 6:47am UTC](https://discuss.elastic.co/t/transporterror-503-search-phase-execution-exception-only-while-using-python-but-not-in-kibana/301164 "2022-03-31T06:47:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harish\_fragger](https://avatars.discourse-cdn.com/v4/letter/h/edb3f5/32.png) [@Harish\_fragger](https://discuss.elastic.co/u/Harish_fragger)\
**Post date:** [March 31, 2022, 6:47am UTC](https://discuss.elastic.co/t/transporterror-503-search-phase-execution-exception-only-while-using-python-but-not-in-kibana/301164/1 "2022-03-31T06:47:57Z")

</div>

I am using python to extract data from my Elasticsearch but suddenly started to get this error : `TransportError(503, 'search_phase_execution_exception')`. I also have kibana working with the same Elasticsearch and I am able to execute the same query in devTools.

Query

```auto
{

                "size" : 10000,

                "sort": { "timestamp": "desc"},

                "_source": ["data.service","data.vpn","data.policyid","data.srccountry1","data.srcip","data.dstip","data.group","data.srcuser","data.tunneltype"],

                "query":{

                    "bool": {

                        "must": [

                            {"exists": {"field": "data.service"}},

                            {"exists": {"field": "data.vpn"}},

                            {"exists": {"field": "data.policyid"}},

                            {"exists": {"field": "data.srccountry1"}},

                            {"exists": {"field": "data.srcip"}},

                            {"exists": {"field": "data.dstip"}},

                            {"match_phrase": {"data.action": "accept"}},

                            {"match_phrase": {"location":host }}

                        ]

                    }

                }

            }

```

And  
`es.indices.exists(index=today_index_name):` to check if index is there or not.

only 2 queries are being executed by python.  
What could be causing this issue? Is this related to SEARCH API which python uses?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 31, 2022, 11:50am UTC](https://discuss.elastic.co/t/transporterror-503-search-phase-execution-exception-only-while-using-python-but-not-in-kibana/301164/2 "2022-03-31T11:50:03Z")

</div>

Can you share the full exception of the response and also add the error\_trace parameter? See [Common options | Elasticsearch Guide [8.1] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.1/common-options.html#common-options-error-options)

---

<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:** [April 28, 2022, 11:50am UTC](https://discuss.elastic.co/t/transporterror-503-search-phase-execution-exception-only-while-using-python-but-not-in-kibana/301164/3 "2022-04-28T11:50:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
