【发布时间】:2022-01-13 00:06:16
【问题描述】:
我正在使用
from elasticsearch import Elasticsearch
from elasticsearch_dsl import UpdateByQuery
UpdateByQuery(index=index).using(es_client).query("match", id=<my_obj_id>)\
.script(source=f"ctx._source.view_count=12345")
更新我的 ElasticSearch 文档之一上的 view_count 字段。
问题出在生产中,有很多文档需要更新,我得到了
TransportError(500, 'general_script_exception', '[script] Too many dynamic script compilations within, max: [75/5m]; please use indexed, or scripts with parameters instead; this limit can be changed by the [script.context.update.max_compilations_rate] setting')
我不确定增加限制是否是一个长期的解决方案。但是我不知道如何一次对多个文档进行批量更新以避免这么多调用?
【问题讨论】:
标签: python elasticsearch