我正在尝试使用 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)
Run Code Online (Sandbox Code Playgroud)
其次是:
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})
Run Code Online (Sandbox Code Playgroud)
我应该如何修改我的代码以使其(请参阅此处)与 Elasticsearch 7X 版本一致?任何形式的帮助将不胜感激。
现在这只是一个警告,但它会在 Elasticsearch 8 中变成一个错误。
从最近几个版本开始,Elasticsearch 一直在计划删除索引内的索引类型
我的建议是设计一个应用程序和映射,使其在索引中不包含类型参数
要知道为什么弹性搜索这样做的原因是一个链接:https : //www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html#_why_are_mapping_types_being_removed
| 归档时间: |
|
| 查看次数: |
3461 次 |
| 最近记录: |