2015-07-12 45 views
0

我有問題讓CircleCI完成使用彈性搜索測試我的Django項目。CircleCI彈性搜索Haystack

這裏是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 

回答

1

,CirleCI的ElasticSearch的默認版本目前v0.90.2和草堆v2.4.X只支持ElasticSearch 1.x版:

http://django-haystack.readthedocs.org/en/latest/installing_search_engines.html#elasticsearch

你想明確地下載ElasticSearch的1.x版+版本的依賴關係之前,你的測試運行:

https://circleci.com/docs/installing-elasticsearch

這爲我工作。

+0

我最近遇到了Circle的ES版本與正在部署的Haystack版本不兼容的問題。我建議使用他們的文檔來定製安裝在開發/生產中使用的任何版本,而不是使用他們的內置ES版本。 – element119