Integrating Haystack 2.0 Beta with Elasticsearch Issue: 'IndexMissingException[[haystack] missing

1,430 views
Skip to first unread message

Eloi Cuevas

unread,
Mar 22, 2012, 1:04:08 PM3/22/12
to django-...@googlegroups.com

I´m trying to update a project from Haystack 1.X to Haystack 2.0 in order to use Elasticsearch backend but i am not confident if it´s running correctly.

How i have integrated Haystack 2.0 Beta / Elasticsearch

Installed / Configured modules by following Haystack Official Documentation:

  • Haystack 2.0 BETA Version
  • Elasticsearch v0.18.7 (i haven´t modified the yaml file because i´m not developing locally)
  • Pyelasticsearch v0.0.5 from toastdriven (don´t use it from rhec, it seems to be incomplete for this purpose)
  • Requests v0.10.6
  • Simplejson v2.4.0

Migrated Haystack Indexes from 1.XX to 2.0 Version as recommends Haystack Official Documentation:

  • Removed old haystack settings and created HAYSTACK_CONNECTIONS targeting elasticSearch, put it as unique and default engine.
  • Used SearchIndex and Indexable for my indexes, added get_model and index_queryset functions 
  • Removed get_queryset deprecated function and the registration statements

Issue:

The point is that unfortunately while i´m trying to rebuild indexes raises this Error:

$ python manage.py rebuild_index
Removing all documents from your index because you said so.
Failed to clear Elasticsearch index: Non-OK status code returned (404) containing 'IndexMissingException[[haystack] missing]'.
All documents removed.


Despite of that haystack rebuild indexes. I was trying to know more about this issue but i haven´t found useful information regarding it. Could anyone give me some clues about this exception?

Eloi Cuevas

unread,
Mar 23, 2012, 6:59:17 AM3/23/12
to django-...@googlegroups.com
Today i have run elasticsearch test to know more about this issue...

Test is passed but still has some dodgy lines regarding Non-OK status errors:

$ django-admin.py test elasticsearch_tests  --settings=elasticsearch_settings
/Library/virtualenvs/lmb/lib/python2.6/site-packages/django/db/__init__.py:60: DeprecationWarning: Short names for ENGINE in database configurations are deprecated. Prepend default.ENGINE with 'django.db.backends.'
  DeprecationWarning
Creating test database for alias 'default'...
Clearing out Elasticsearch...
.............Clearing out Elasticsearch...
.Clearing out Elasticsearch...
Failed to clear Elasticsearch index: Non-OK status code returned (404) containing 'IndexMissingException[[test_default] missing]'.
.Clearing out Elasticsearch...
.Clearing out Elasticsearch...
.Clearing out Elasticsearch...
.Clearing out Elasticsearch...
.Clearing out Elasticsearch...
.Clearing out Elasticsearch...
......................Clearing out Elasticsearch...
.Clearing out Elasticsearch...
.Clearing out Elasticsearch...
Failed to fetch More Like This from Elasticsearch for document 'core.mockmodel_deferred_foo.1': Non-OK status code returned (500) containing 'ElasticSearchException[document missing]'.
.Clearing out Elasticsearch...
.Clearing out Elasticsearch...
.Reloading data...
Clearing out Elasticsearch...
......................Clearing out Elasticsearch...
.Clearing out Elasticsearch...
.
----------------------------------------------------------------------
Ran 71 tests in 10.702s

OK
Destroying test database for alias 'default'...

Eloi Cuevas

unread,
Mar 30, 2012, 7:47:23 AM3/30/12
to django-...@googlegroups.com

More about my Haystack & ES Enviroment:
  • Python 2.6.1
  • Django 1.3.1

Stephen Burrows

unread,
Mar 30, 2012, 9:34:31 PM3/30/12
to django-...@googlegroups.com
Don't worry about those messages; they're annoying, but AFAICT they don't signal anything bad.


--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-haystack/-/YRNBXTpReewJ.

To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.

Kevin Tran

unread,
Aug 3, 2012, 1:15:07 AM8/3/12
to django-...@googlegroups.com
I am also getting this error. It is a serious problem if you set SILENTLY_FAIL to False in the Haystack connection settings. In my case I cannot even rebuild the index because it loudly crashes on this error.

Is this a bug in Haystack? Does anyone know what the real cause of it is?

Below is my traceback.

$ bin/manage rebuild_index

WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y

Removing all documents from your index because you said so.
Traceback (most recent call last):
  File "bin/manage", line 42, in <module>
    djangorecipe.manage.main('dje.settings')
  File "/Users/haitran/.buildout/eggs/djangorecipe-1.1.2-py2.6.egg/djangorecipe/manage.py", line 19, in main
    management.execute_manager(mod)
  File "/Users/haitran/.buildout/eggs/Django-1.4-py2.6.egg/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/Users/haitran/.buildout/eggs/Django-1.4-py2.6.egg/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/haitran/.buildout/eggs/Django-1.4-py2.6.egg/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/haitran/.buildout/eggs/Django-1.4-py2.6.egg/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/haitran/.buildout/eggs/django_haystack-2.0.0_beta-py2.6.egg/haystack/management/commands/rebuild_index.py", line 14, in handle
    call_command('clear_index', **options)
  File "/Users/haitran/.buildout/eggs/Django-1.4-py2.6.egg/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/Users/haitran/.buildout/eggs/Django-1.4-py2.6.egg/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/haitran/.buildout/eggs/django_haystack-2.0.0_beta-py2.6.egg/haystack/management/commands/clear_index.py", line 41, in handle
    backend.clear()
  File "/Users/haitran/.buildout/eggs/django_haystack-2.0.0_beta-py2.6.egg/haystack/backends/elasticsearch_backend.py", line 224, in clear
    self.conn.refresh(indexes=[self.index_name])
  File "/Users/haitran/repos/dejacode/enterprise/pyelasticsearch.py", line 412, in refresh
    response = self._send_request('POST', path)
  File "/Users/haitran/repos/dejacode/enterprise/pyelasticsearch.py", line 213, in _send_request
    raise ElasticSearchError("Non-OK status code returned (%d) containing %r." % (resp.status_code, prepped_response.get('error', prepped_response)))
pyelasticsearch.ElasticSearchError: Non-OK status code returned (404) containing u'IndexMissingException[[haystack] missing]'.

On Friday, March 30, 2012 6:34:31 PM UTC-7, Stephen Burrows wrote:
Don't worry about those messages; they're annoying, but AFAICT they don't signal anything bad.

On Fri, Mar 30, 2012 at 4:47 AM, Eloi Cuevas <f15...@gmail.com> wrote:

More about my Haystack & ES Enviroment:
  • Python 2.6.1
  • Django 1.3.1

--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-haystack/-/YRNBXTpReewJ.

To post to this group, send email to django-haystack@googlegroups.com.
To unsubscribe from this group, send email to django-haystack+unsubscribe@googlegroups.com.

Kevin Tran

unread,
Sep 20, 2012, 6:37:20 AM9/20/12
to django-...@googlegroups.com
This was solved in the pull request https://github.com/toastdriven/django-haystack/pull/647
Reply all
Reply to author
Forward
0 new messages