【问题标题】:How to increase the max_result_window in elasticsearch using a python script?如何使用python脚本增加elasticsearch中的max_result_window?
【发布时间】:2017-03-04 05:03:48
【问题描述】:

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

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

但是我如何使用 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 的设置

【问题讨论】:

    标签: python elasticsearch python-2.6 elasticsearch-plugin spring-data-elasticsearch


    【解决方案1】:

    你需要使用put_settings方法。

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

    【讨论】:

    • 很高兴我能帮上忙
    • 感谢陈丹的帮助
    • 我正在尝试使用此解决方案,但出现错误。有人看到这条评论,能不能快点查一下my question
    【解决方案2】:

    如果有人正在搜索 ElasticSearch Ruby solution,那么在 ES 版本 5 上对我有用的是:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-13
      • 2020-04-23
      • 1970-01-01
      • 2017-05-03
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      • 2012-01-29
      相关资源
      最近更新 更多