[Django]-Django Elastic Search: AttributeError: type object 'PostDocument' has no attribute 'Django'

11👍

It’s not Meta class, it should be Django class which you should create and tell model, fields and other config related to this document and it’s model.
Please see documentation and it’s sample example.
https://github.com/sabricot/django-elasticsearch-dsl#quickstart

from django_elasticsearch_dsl import Document, Index
from django_elasticsearch_dsl.registries import registry
from blog2.models import Article

posts = Index('articles')

@registry.register_document
@posts.document
class PostDocument(Document):
    class Django:
        model = Article

        fields = [
            'alias',
            'author',
            'title',
            'body',
            'category',
        ]

Leave a comment