IndexMissingException - dayango haystack with elasticsearch

I am trying to configure hay search using elasticearch backend I get the following error:

./manage.py rebuild_index ... Failed to clear Elasticsearch index: (404, u'IndexMissingException[[haystack] missing]') 

However, the following command works:

 curl -XPUT http://33.33.33.1:9200/haystack {"ok":true,"acknowledged":true} curl -XGET http://33.33.33.1:9200/haystack/test/something {"_index":"haystack","_type":"test","_id":"something","exists":false} 

Now after launch

 ./manage.py rebuild_index ... Failed to clear Elasticsearch index: (404, u'IndexMissingException[[haystack] missing]') 

again, unexpectedly, the command that worked as expected now gives the following error:

 curl -XGET http://33.33.33.1:9200/haystack/test/something {"error":"IndexMissingException[[haystack] missing]","status":404} 

As in other places, I also tried:

 from django.core import management from haystack import connections backend = connections['default'].get_backend() backend.setup_complete = False backend.existing_mapping = None management.call_command('rebuild_index', interactive=False, verbosity=0) 

with the same result:

 {"error":"IndexMissingException[[haystack] missing]","status":404} 

I am running Django 1.4.2, django-haystack HEAD from github and pyelasticsearch HEAD from github

configurations:

 HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', 'URL': 'http://33.33.33.1:9200/', 'INDEX_NAME': 'haystack', }, } 

Can anybody help me?

+7
source share
2 answers

Stupid of me. I did not extend my Index class from indexes.Indexable , as required by haystack 2. Therefore, the haystack simply did not pick up my index and did not end correctly without further notice. The error message is somewhat misleading. Haystack always seems to give this if you call rebuild_index, regardless of whether the pointer existed or not.

+6
source

Well create an index using curl and use instead of using the rebuild index. /manage.py update_index Just to save the day.

+1
source

All Articles