Skip to content

Allow update_index management command to only update a subset of models #45

@gasman

Description

@gasman

Is your proposal related to a problem?

From wagtail/wagtail#7825:

We have a project which takes approximately 20 minutes to run update_index, which means adding additional indexes during development is really slow - if there are issues with the new index creation functions for elasticsearch, etc, it can be painful.

Describe the solution you'd like

The ./manage.py update_index command should accept a command-line option listing the set of models to be reindexed.

Additional context

As noted in wagtail/wagtail#7825, simply updating the management command code to only operate on the given models is not sufficient, because for most search backends, the rebuilder starts by clearing out the entire index - meaning that the models not passed to the command will be removed from the index, rather than left alone. This probably requires extending the API of the 'rebuilder' class within the backends, to support being passed a list of models. It may well be the case that a lot of the logic within update_index.py, such as knowing which indexes correspond to which models, ought to be moved into the search backend, and the update_index.py script becomes a thin wrapper around the rebuilder class, just providing the command-line parsing and the progress feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions