简体   繁体   English

使用Haystack的CircleCI弹性搜索

[英]CircleCI Elastic Search with Haystack

I am having issue getting CircleCI to complete tests with Elastic Search for my Django Project. 我在让CircleCI用Django项目的Elastic Search完成测试时遇到问题。

Here is an exert from settings.py 这是来自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'

Here is the error from the CircleCI report. 这是CircleCI报告中的错误。 It shows up on almost every interaction with the database. 它几乎显示了与数据库的所有交互。

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'}}])

Here is my circle.yml file that configures the CircleCI tester: 这是配置CircleCI测试器的我的circle.yml文件:

machine:
  environment:
    DATABASE_URL: mysql://ubuntu:@localhost:3306/circle_test
    CUSTOM_DATABASE_URL: mysql://ubuntu:@localhost:3306/circle_test
services:
   - elasticsearch

Right now, CirleCI's default version of ElasticSearch is currently v0.90.2 and Haystack v2.4.X only supports ElasticSearch v1.X: 目前,CirleCI的默认ElasticSearch版本为v0.90.2,而Haystack v2.4.X仅支持ElasticSearch v1.X:

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

You want to explicitly download a v1.X+ version of ElasticSearch as a dependency before your tests are ran: 您想在运行测试之前显式下载ElasticSearch的v1.X +版本作为依赖项:

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

This worked for me. 这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM