Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "exclude_fields" to class Elasticsearch #70

Open
sadnoodles opened this issue May 18, 2017 · 0 comments
Open

Add "exclude_fields" to class Elasticsearch #70

sadnoodles opened this issue May 18, 2017 · 0 comments

Comments

@sadnoodles
Copy link

sadnoodles commented May 18, 2017

Can you add a exclude_fields to class Elasticsearch to only exclude some fields?

I'm using abstract model. I have a lot of models have a uuid field (and other fields) which is useless for search. Its painfull to use fields to specify each model to exclude the uuid field.

My code like this:

class CommonAttr(models.Model):
    create_date = models.DateTimeField(u"Create data", auto_now_add=True) # exclude
    uuid = models.CharField(u'UUID', max_length=36, unique=True) # exclude

    class Meta:
        abstract = True

    class Elasticsearch(EsIndexable.Elasticsearch):
        exclude_fields = ['uuid',  'create_date']  # this is very usefull for abstract model

class A(CommonAttr):
    pass

class B(CommonAttr):
    pass

Can you add a exclude_fields to only exclude some fields?
Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant