elasticsearch - ValueError : URL must include a 'scheme' , 'host' 和 'port' 组件

标签 elasticsearch pycharm

尝试对项目使用 Elasticsearch 。

from elasticsearch import Elasticsearch
es = Elasticsearch(
    "https://example.com",
    http_auth=("abc", "bcd"),
)

但是出现错误:

ValueError: URL must include a 'scheme', 'host', and 'port' component (ie 'https://localhost:9200')

我在 Pycharm CE 上运行它并创建了 Python 3.9 的虚拟环境。 我应该使用不同版本的 Python 来完成这项工作吗? 此外,我已经尝试过 pip install acryl-datahub[datahub-rest,elasticsearch]==0.8.27.1 但无济于事。

最佳答案

我遇到了同样的错误。安装 ES 版本 7.17 解决了这个问题。我在 pip install acryl-datahub[datahub-rest,elasticsearch]==0.8.27.1 上也遇到了不可用问题。尝试使用下一个可用版本 (0.8.28.0) 并意识到它正在将 elasticsearch 降级到 7.17。

所以试试pip install elasticsearch==7.17

关于elasticsearch - ValueError : URL must include a 'scheme' , 'host' 和 'port' 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73512557/

相关文章:

elasticsearch - 在 Elasticsearch 查询中获取数据而不匹配完整字符串

python - 如何使 Wagtail 搜索不区分大小写

function - Elasticsearch Nest错误的function_Score JSON生成

module - Pycharm os.get_terminal_size() 不工作

python - 如何将 'cluster'和 'pylab'导入Pycharm

hadoop - 使用 ElasticSearch 作为永久存储

java - Elasticsearch ,Java API : Validation Failed: 1: script or doc is missing;

php - 直接在 PhpStorm 中运行 PHP 脚本

pycharm - 获取在 PyCharm 终端中运行的 Anaconda prompt

python - 有没有办法用 PyCharm 捕获单元测试异常?