liberation / django-elasticsearch

Simple wrapper around elasticsearch-py to index/search a django Model.
MIT License
211 stars 73 forks source link

es.flush() throws AttributeError #59

Closed Dean-Christian-Armada closed 8 years ago

Dean-Christian-Armada commented 8 years ago

I do not know if this is a bug but I tried doing:

Artist.es.flush()

However it returned:

AttributeError: 'IndicesClient' object has no attribute 'delete_mapping'

My models.py is:

# Create your models here.
class Artist(EsIndexable, models.Model):
    name = models.CharField(max_length=50)
    birth_date = models.DateField()

    # https://docs.djangoproject.com/es/1.9/ref/models/instances/#get-absolute-url
    # Used to pass a location header URL upon post
    def get_absolute_url(self):
        return reverse('artists-detail', kwargs={'artist_id':self.id})

    def __unicode__(self):
        return self.name

    def get_albums(self):
        x = Album.objects.filter(artist_id=self.id)
        # print x.values('name')
        return x.values('name')

I have this on my settings.py:

ELASTICSEARCH_AUTO_INDEX = 1

lauxley commented 8 years ago

Hi, this package is not yet compatible with Elasticsearch 2.0, i'm working on it but I don't know when it will be ready, and it will probably require to create the first release to somewhat keep the Elasticsearch 1 compat so it means it also depends on other important feature/compatibility issues.

In the meantime you can either downgrade to elasticsearch 1 or do the indexing yourself - the problem is that delete mapping has been removed from elasticsearch's API, we only have the choice to delete the index now - and hope you don't run into another problem.

Dean-Christian-Armada commented 8 years ago

Thank you for the details