Ast*_*pta 6 python doctype elasticsearch
我想从弹性搜索中读取特定索引和特定类型的文档。我构造查询:
es.search(index="document_index, doc_type="document_type", body={"query": {"match_all": {}}})['hits']['total']
我收到错误TypeError: search() got an unexpected keyword argument 'doc_type'。我浏览了下面给出的几个链接来寻找解决方案,但主要答案是降级 ES 版本。但我们的要求是保留ES版本5.6。
还有更多
有没有其他方法可以提及文档类型?
看来你的elasticsearch python客户端版本高于v5.6. 删除现有的doc_type兼容版本,例如 5.5.3
删除: pip uninstall elasticsearch
然后安装 pip install elasticsearch==5.5.3
注意我建议这样做,因为elasticsearch不再支持每个索引使用多个文档类型doc_type
| 归档时间: |
|
| 查看次数: |
21434 次 |
| 最近记录: |