我在让CircleCI为我的Django项目完成弹性搜索测试时遇到了问题。
下面是来自settings.py的一点优势
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'index_elasticsearch',
},
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'这是来自CircleCI报告的错误。它几乎出现在与数据库的每一次交互中。
File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 155, in streaming_bulk
raise BulkIndexError('%i document(s) failed to index.' % len(errors), errors)
BulkIndexError: ('1 document(s) failed to index.', [{u'index': {u'_type': u'modelresult', u'_id': u'website.query.1', u'ok': True, u'_version': 19, u'_index': u'index_elasticsearch'}}])下面是配置CircleCI测试器的circle.yml文件:
machine:
environment:
DATABASE_URL: mysql://ubuntu:@localhost:3306/circle_test
CUSTOM_DATABASE_URL: mysql://ubuntu:@localhost:3306/circle_test
services:
- elasticsearch发布于 2016-03-28 13:19:57
目前,CirleCI默认版本的ElasticSearch目前是0.90.2版,Haystack 2.4.X版只支持ElasticSearch 1.X版:
http://django-haystack.readthedocs.org/en/latest/installing_search_engines.html#elasticsearch
在运行测试之前,您希望显式下载ElasticSearch的v1.X+版本作为依赖项:
https://circleci.com/docs/installing-elasticsearch
这对我很有效。
https://stackoverflow.com/questions/31364336
复制相似问题