【ElasticSearch】在Flask中使用ElasticSearch实现全文搜索功能

报错:

elasticsearch.exceptions.ConnectionError

原因:

You seem to have missed that Elasticsearch is not a Python package. The package that you installed with pip is the Elasticsearch client. You still need to have the service installed on your system as well. This is going to be the process that opens port 9200.

也就是说pip安装的只是Elasticsearch客户端,还需要安装Elasticsearch服务端,之后再开启9200端口

安装Elasticsearch服务端

安装 + 启动Elasticsearch


另一个错误

TypeError: search() got an unexpected keyword argument 'doc_type'

这是由于elasticsearch版本更新导致的,elasticsearch更新到7之后,就没有了doc_type这个参数只需要在原来elasticsearch6代码的基础上删除doc_type这个即可。

学习链接

https://cuiqingcai.com/6214.html

你可能感兴趣的:(Flask)