Python Search POST request


#1

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)


(system) #2

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