How to increase max_result_window in elasticsearch using python script?

I know we can use curl to increase max_result_window somehow like:

curl -XPUT "http://localhost:9200/index1/_settings" -d '{ "index" : { "max_result_window" : 500000} }'

But how can I do the same with python?

My code

es = Elasticsearch(['http://localhost:9200'])

res = es.search(index="index1", doc_type="log",size=10000, from_=0, body={ "query": {
....query starts
}})

My question is: how to change the max_result_window parameter here .

+4
source share
2 answers

You need to use the put_settings method .

es.indices.put_settings(index="index1",
                        body= {"index" : {
                                "max_result_window" : 500000
                              }})
+3
source

If someone is looking for an ElasticSearch Ruby solution , then what worked for me on ES version 5 was:

es.indices.put_settings(body: {index: {max_result_window: 500000}})
+1
source

Source: https://habr.com/ru/post/1658493/


All Articles