Closed johnfelipe closed 9 years ago
I don't think sayit_mysociety_org.search.backends.SayitElasticSearchEngine
is a valid engine. Use haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine
.
Ah, that engine exists in https://github.com/mysociety/sayit.mysociety.org which isn't used by this project.
Is not work for me, is possible:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'sayit_mysociety_org.search.backends.SayitElasticSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': SEARCH_INDEX_NAME,
},
'write': {
'ENGINE': 'sayit_mysociety_org.search.backends.SayitElasticSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': '%s_write' % SEARCH_INDEX_NAME,
},
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
change for:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': SEARCH_INDEX_NAME,
},
'write': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': '%s_write' % SEARCH_INDEX_NAME,
},
}
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
Please put your full settings.py in a Gist as it's impossible to debug otherwise.
Have you indexed your content?
python manage.py rebuild_index --noinput
(virtualenv-sayit)felipe@vps:~/sayit/sayit.mysociety.org$ python manage.py rebuild_index --noinput
Removing all documents from your index because you said so.
Failed to clear Elasticsearch index: ('Connection aborted.', error(111, 'Connection refused'))
Failed to clear Elasticsearch index: ('Connection aborted.', error(111, 'Connection refused'))
All documents removed.
Indexing 1434 speakers
ERROR:root:Error updating speeches using default
Traceback (most recent call last):
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 183, in update
self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 96, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 388, in bulk_index
query_params=query_params)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 238, in send_request
**({'data': request_body} if body else {}))
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 508, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/rebuild_index.py", line 16, in handle
call_command('update_index', **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 195, in handle
return super(Command, self).handle(*items, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 385, in handle
label_output = self.handle_label(label, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 183, in update
self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 96, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 388, in bulk_index
query_params=query_params)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 238, in send_request
**({'data': request_body} if body else {}))
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 508, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))
solved restarting elasticsearch:
(virtualenv-sayit)felipe@vps:~/sayit/sayit.mysociety.org$ python manage.py rebuild_index --noinput
Removing all documents from your index because you said so.
Failed to clear Elasticsearch index: Non-OK response returned (404): u'IndexMissingException[[sayit_write] missing]'
All documents removed.
Indexing 1434 speakers
Indexing 424 sections
Indexing 10624 speeches
Indexing 1434 speakers
Indexing 424 sections
Indexing 10624 speeches
Now what
Look again, and i dont do it nothing, dont work
It was working. Now it isn't. I can't debug whatever it is you're doing to make it start and stop.
i have share log if you teach me path to find it
How share you log still no working
Something i missing with elasticsearch?
what happens if you restart elasticsearch and run python manage.py rebuild_index --noinput
again?
(virtualenv-sayit)felipe@vps:~/sayit/sayit.mysociety.org$ python manage.py rebuild_index --noinput
Removing all documents from your index because you said so.
Failed to clear Elasticsearch index: ('Connection aborted.', error(111, 'Connection refused'))
Failed to clear Elasticsearch index: ('Connection aborted.', error(111, 'Connection refused'))
All documents removed.
Indexing 1434 speakers
ERROR:root:Error updating speeches using default
Traceback (most recent call last):
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 183, in update
self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 96, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 388, in bulk_index
query_params=query_params)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 238, in send_request
**({'data': request_body} if body else {}))
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 508, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/rebuild_index.py", line 16, in handle
call_command('update_index', **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 195, in handle
return super(Command, self).handle(*items, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 385, in handle
label_output = self.handle_label(label, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 183, in update
self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 96, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 388, in bulk_index
query_params=query_params)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 238, in send_request
**({'data': request_body} if body else {}))
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 508, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))
I need always do this for works:
sudo /etc/init.d/elasticsearch start
curl -XGET 'localhost:9200'
(virtualenv-sayit)felipe@vps:~/sayit/sayit.mysociety.org$ python manage.py rebuild_index --noinput
Removing all documents from your index because you said so.
All documents removed.
Indexing 1434 speakers
Indexing 424 sections
Indexing 10624 speeches
ERROR:root:Error updating speeches using default
Traceback (most recent call last):
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 183, in update
self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 96, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 388, in bulk_index
query_params=query_params)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 238, in send_request
**({'data': request_body} if body else {}))
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 508, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/adapters.py", line 433, in send
raise ReadTimeout(e, request=request)
ReadTimeout: HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=10)
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/rebuild_index.py", line 16, in handle
call_command('update_index', **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 195, in handle
return super(Command, self).handle(*items, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/django/core/management/base.py", line 385, in handle
label_output = self.handle_label(label, **options)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 221, in handle_label
self.update_backend(label, using)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 267, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 183, in update
self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 96, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 388, in bulk_index
query_params=query_params)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/pyelasticsearch/client.py", line 238, in send_request
**({'data': request_body} if body else {}))
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 508, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/home/felipe/sayit/virtualenv-sayit/local/lib/python2.7/site-packages/requests/adapters.py", line 433, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=10)
You have an Elasticsearch issue. I don't know how to solve it. Maybe try Elasticsearch support or StackOverflow.
Tnks so much
in .py file i have
I dont understand why dont work