# Python Search POST request

**URL:** <https://discuss.elastic.co/t/python-search-post-request/153595>\
**Category:** Elasticsearch\
**Created:** [October 23, 2018, 12:16pm UTC](https://discuss.elastic.co/t/python-search-post-request/153595 "2018-10-23T12:16:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![petrop](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@petrop](https://discuss.elastic.co/u/petrop)\
**Post date:** [October 23, 2018, 12:16pm UTC](https://discuss.elastic.co/t/python-search-post-request/153595/1 "2018-10-23T12:16:46Z")

</div>

Hi all,

I have been developing a script to query some particular data on Elasticsearch.  
When I run my query I need to use the scroll function because I receive too many results.  
Therefore, I pass the scroll\_id to the scroll function. However, it looks like sometimes it fails  
due to having too long GET request.

After that I decided to change my request method to POST so that I include the scroll\_id within the body instead. However, when I run the request I receive a Bad Request (400) error. I have no clue why that is.  
Could you help with that or drop an idea?

I'm using the elasticsearch module on Python to do my queries.

My code looks like the following:  
`
q = '{"size": 100, "query": { "bool": { "filter": [{"term": { "log_component" : "mycomponent"}}]}}}'
es.transport.perform_request('POST', '/logstash-*/_search', body=q)
`

---

<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:** [November 20, 2018, 12:16pm UTC](https://discuss.elastic.co/t/python-search-post-request/153595/2 "2018-11-20T12:16:52Z")

</div>

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