如何使用 Python API 增加 ElasticSearch 总字段限制
使用 ElasticSearch 时,插入大文档时有时会遇到 Limit of total fields [1000] has been exceeded。
对于实际场景通常有效的一个解决方案是将默认限制 1000 增加到例如 100000,以适应最大的文档。
然而,ElasticSearch Python API 的文档对此说明不充分。以下是你可以如何做到:
increase_es_total_fields_limit.py
from elasticsearch import Elasticsearch
es = Elasticsearch()
es.indices.put_settings(index="my-index", body={
"index.mapping.total_fields.limit": 100000
})Check out similar posts by category:
Databases, ElasticSearch, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow