如何使用python脚本增加Elasticsearch中的max_result_window? [英] How to increase the max_result_window in elasticsearch using a python script?

查看:305
本文介绍了如何使用python脚本增加Elasticsearch中的max_result_window?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,我们可以使用curl来增加max_result_window,例如:

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} }'

但是我如何使用python做同样的事情?

But How do I do the same using python?

我的代码

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

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

我的问题是如何在此处更改max_result_window的设置

推荐答案

您需要使用 put_settings 方法。

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

这篇关于如何使用python脚本增加Elasticsearch中的max_result_window?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆