Resetcollectionindex
snoop.data.management.commands.resetcollectionindex
#
Wipe and recreate ES index.
Classes#
Command
#
Wipe and recreate the ElasticSearch index for a given collection
Methods#
add_arguments(self, parser)
#
Entry point for subclassed commands to add custom arguments.
Source code in snoop/data/management/commands/resetcollectionindex.py
def add_arguments(self, parser):
parser.add_argument('collection', type=str)
handle(self, collection, **options)
#
The actual logic of the command. Subclasses must implement this method.
Source code in snoop/data/management/commands/resetcollectionindex.py
def handle(self, collection, **options):
logging_for_management_command(options['verbosity'])
with Collection(collection).set_current():
indexing.delete_index()
indexing.create_index()