Python 操作ES

1.安装pip

参考地址:https://blog.51cto.com/wangshiyu/5267092

要指定版本,否则运行代码回报错。

 pip install  elasticsearch==7.13.0   -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com

2.代码

from elasticsearch import Elasticsearch
es = Elasticsearch(hosts='http://10.11.1.66:9200')
result = es.search(index='store')
print(result)

参考地址:https://blog.csdn.net/qq_43076825/article/details/108404335

https://blog.csdn.net/a1309525802/article/details/108327846

posted @ 2023-05-23 10:48  创客未来  阅读(34)  评论(0编辑  收藏  举报