简体   繁体   中英

CircleCI Elastic Search with Haystack

I am having issue getting CircleCI to complete tests with Elastic Search for my Django Project.

Here is an exert from 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. 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:

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:

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:

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

This worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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