Django haystack with elasticsearch, indexing issue -
im using django-haystack elasticsearch there problem indexing. when rebuilding index
python manage.py rebuild_indexfollowing error raised:
traceback (most recent call last): file "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 210, in handle_label self.update_backend(label, using) file "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 256, in update_backend do_update(backend, index, qs, start, end, total, self.verbosity) file "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 78, in do_update backend.update(index, current_qs) file "/home/palo/.virtualenvs/toro/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 177, in update self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=id) file "/home/palo/.virtualenvs/toro/src/pyelasticsearch/pyelasticsearch/client.py", line 95, in decorate return func(*args, query_params=query_params, **kwargs) file "/home/palo/.virtualenvs/toro/src/pyelasticsearch/pyelasticsearch/client.py", line 366, in bulk_index query_params=query_params) file "/home/palo/.virtualenvs/toro/src/pyelasticsearch/pyelasticsearch/client.py", line 221, in send_request **({'data': request_body} if body else {})) file "/home/palo/.virtualenvs/toro/src/requests/requests/sessions.py", line 387, in post return self.request('post', url, data=data, **kwargs) file "/home/palo/.virtualenvs/toro/src/requests/requests/sessions.py", line 345, in request resp = self.send(prep, **send_kwargs) file "/home/palo/.virtualenvs/toro/src/requests/requests/sessions.py", line 448, in send r = adapter.send(request, **kwargs) file "/home/palo/.virtualenvs/toro/src/requests/requests/adapters.py", line 324, in send raise timeout(e) timeout: httpconnectionpool(host='127.0.0.1', port=9200): request timed out. (timeout=10) timeout: httpconnectionpool(host='127.0.0.1', port=9200): request timed out. (timeout=10)
i used django-haystack - 2.0.0-beta, pyelasticsearch - 0.5, elasticsearch 0.20.6, java version "1.6.0_24"
haystack settings
haystack_connections = { 'default': { 'engine': 'haystack.backends.elasticsearch_backend.elasticsearchsearchengine', 'url': 'http://127.0.0.1:9200/', 'index_name': 'haystack', }, }
and im sure elasticsearch serivce running.
this not mean es server down, if reasonable returned curl -i "127.0.0.1:9200"
. more likely, issue of request not getting enough time given speed of connections involved.
interestingly, default timeout set in pyelasticsearch 60 seconds, see def __init__(self, urls, timeout=60, max_retries=0, revival_delay=300):
in https://github.com/rhec/pyelasticsearch/blob/master/pyelasticsearch/client.py. however, haystack overwrites default setting, 10 seconds, per self.timeout = connection_options.get('timeout', 10)
in https://github.com/toastdriven/django-haystack/blob/master/haystack/backends/__init__.py.
as can see though, haystack allows modify setting, adding 'timeout': 60,
engine configuration.
and solved :)
Comments
Post a Comment