elasticsearch数据查询

正在找可视化查询数据的工具,由于日常sql写的多,就再找有没有工具可以直接写sql就能查出来,果真有一款工具可以写sql opendistro-for-elasticsearch/,之前用浏览器插件ElasticSearch Head,发现不灵活以后,过段换成了这个。

安装的时候遇到了问题,我的是mac pro,python3.8环境,运行提示:

❯ odfesql
Traceback (most recent call last):
  File "/Users/lijshu/venv/bin/odfesql", line 5, in <module>
    from odfe_sql_cli.main import cli
  File "/Users/lijshu/venv/lib/python3.9/site-packages/odfe_sql_cli/main.py", line 21, in <module>
    from .esconnection import ESConnection
  File "/Users/lijshu/venv/lib/python3.9/site-packages/odfe_sql_cli/esconnection.py", line 22, in <module>
    from elasticsearch import Elasticsearch, RequestsHttpConnection
  File "/Users/lijshu/venv/lib/python3.9/site-packages/elasticsearch/__init__.py", line 24, in <module>
    from .client import Elasticsearch
  File "/Users/lijshu/venv/lib/python3.9/site-packages/elasticsearch/client/__init__.py", line 5, in <module>
    from ..transport import Transport
  File "/Users/lijshu/venv/lib/python3.9/site-packages/elasticsearch/transport.py", line 5, in <module>
    from .connection import Urllib3HttpConnection
  File "/Users/lijshu/venv/lib/python3.9/site-packages/elasticsearch/connection/__init__.py", line 2, in <module>
    from .http_requests import RequestsHttpConnection
  File "/Users/lijshu/venv/lib/python3.9/site-packages/elasticsearch/connection/http_requests.py", line 3, in <module>
    from base64 import decodestring
ImportError: cannot import name 'decodestring' from 'base64' (/usr/local/Cellar/python@3.9/3.9.1_1/Frameworks

 解决办法:

  • upgrade elasticsearch-py dependency from 7.5.1 to 7.10.1
  • pip3 uninstall elasticsearch==7.5.1

  •  pip3 install elasticsearch

     

备注:可能是我笔记本环境之前有一些别的包冲突导致,最后安装成功运行,能查询数据了。

 

posted @ 2021-03-09 21:23  5sdba  阅读(1055)  评论(0编辑  收藏  举报