gpt4 book ai didi

python - python和 Elasticsearch 更新错误

转载 作者:行者123 更新时间:2023-12-03 00:18:15 27 4
gpt4 key购买 nike

今天,我将 flex 搜索从1.6更新到2.1,因为1.6是易受攻击的版本,在此更新后我的网站无法正常工作,出现此错误:

Traceback (most recent call last):
File "manage.py", line 8, in <module>
from app import app, db
File "/opt/project/app/__init__.py", line 30, in <module>
es.create_index(app.config['ELASTICSEARCH_INDEX'])
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 93, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 1033, in create_index
query_params=query_params)
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 285, in send_request
self._raise_exception(status, error_message)
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 299, in _raise_exception
raise error_class(status, error_message)
pyelasticsearch.exceptions.ElasticHttpError: (400, u'index_already_exists_exception')
make: *** [run] Error 1

代码是这样的:
redis = Redis()

es = ElasticSearch(app.config['ELASTICSEARCH_URI'])
try:
es.create_index(app.config['ELASTICSEARCH_INDEX'])
except IndexAlreadyExistsError, e:
pass

哪里错了?这个新版本有什么新功能?

最佳答案

您收到以下错误:index_already_exists_exception
这意味着您正在尝试创建一个已经存在的索引。第二次运行程序时,您需要首先delete your index或仅在它不存在时创建它。

关于python - python和 Elasticsearch 更新错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34086062/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com