9

I know, we can use the curl to increase the max_result_window as something like:

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

But How do I do the same using 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,do I change the setting for max_result_window here.

Wondercricket
  • 7,651
  • 2
  • 39
  • 58
Mayank Jha
  • 939
  • 3
  • 12
  • 24

2 Answers2

16

You need to use put_settings method.

es.indices.put_settings(index="index1",
                        body= {"index" : {
                                "max_result_window" : 500000
                              }})
ChintanShah25
  • 12,366
  • 3
  • 43
  • 44
1

In case somebody is searching for a ElasticSearch Ruby solution, what worked for me on ES version 5 was:

es.indices.put_settings(body: {index: {max_result_window: 500000}})
Diogo Publio
  • 9
  • 1
  • 2