Skip to content

Document.related_model has a dangerous use case #334

Open
@timo-piirmann

Description

@timo-piirmann

As an example I'm using the official documentation linked here: https://django-elasticsearch-dsl.readthedocs.io/en/latest/fields.html?highlight=related_model#handle-relationship-with-nestedfield-objectfield

There's a CarDocument which has Manufacturer and Ad listed in related_models.

If anyone updated Manufacturer, the related Car instances are re-indexed to ES. If anyone saves an Ad then the related Car instance is also re-indexed to ES. So far so good.

But if anyone DELETE-s and Ad then related Car document in ES gets removed. And this in my case is not obvious or preferred. I think that what should happen is just a re-index of Car document.

OR maybe at least an explicit warning in the documentations on what happends during related model delete

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions