In Wagtail's documentation on ElasticSearch indexing, it seems that all instances of a given model are added to the index. But I'd like to exclude some (many) rows from being indexed, either by creating a QuerySet or by being able to set an exclude
param of some kind (QuerySet would be better).
Is there any way to do this? Or do I need to index WT models from outside of Wagtail?
You can define a get_indexed_objects
method on the model class, returning a queryset of items to be indexed:
@classmethod
def get_indexed_objects(cls):
return cls.objects.filter(live=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With