【发布时间】:2020-12-23 11:01:02
【问题描述】:
我正在尝试使用 Elasticsearch Ver 7.1 在 Python 中运行以下代码,但是出现以下错误:
ElasticsearchDeprecationWarning: [types removal] Using include_type_name in put mapping requests is deprecated. The parameter will be removed in the next major version.
client.indices.put_mapping(index=indexName,doc_type='diseases', body=diseaseMapping, include_type_name=True)
接着是:
ElasticsearchDeprecationWarning: [types removal] Specifying types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).
client.index(index=indexName,doc_type=docType, body={"name": disease,"title":currentPage.title,"fulltext":currentPage.content})
我应该如何修改我的代码以使其 (see here) 与 Elasticsearch 7X 版本一致?任何形式的帮助将不胜感激。
【问题讨论】:
-
看起来代码只是抛出警告而不是错误。这只是意味着您正在使用的库的一项功能将很快从 Elasticsearch 中删除。使用与您正在使用的 ES 版本匹配的 Elasticsearch python 库版本应该可以解决此问题。
-
非常感谢您的快速回复。如果不是错误,我会保持原样。
标签: elasticsearch