#NEWLINE# def subcommand_rebuild( self , indexes , no_input = False ) : #NEWLINE# #INDENT# if getattr ( settings , 'DEBUG' , False ) : #NEWLINE# #INDENT# import warnings #NEWLINE# warnings . warn ( 'Rebuilding with `settings.DEBUG = True` can result in out of memory crashes. See https://docs.djangoproject.com/en/stable/ref/settings/#debug' , stacklevel = 2 ) #NEWLINE# no_input = False #NEWLINE# #UNINDENT# user_input = ( 'y' if no_input else '' ) #NEWLINE# while ( user_input != 'y' ) : #NEWLINE# #INDENT# user_input = raw_input ( 'Are you sure you want to rebuild {0} index(es)? [y/N]: ' . format ( ( ( 'the ' + ', ' . join ( indexes ) ) if indexes else '**ALL**' ) ) ) . lower ( ) #NEWLINE# if ( user_input in [ 'n' , '' ] ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# if ( user_input == 'y' ) : #NEWLINE# #INDENT# sys . stdout . write ( 'Rebuilding ES indexes: ' ) #NEWLINE# ( results , aliases ) = rebuild_indices ( indices = indexes ) #NEWLINE# sys . stdout . write ( 'complete.\n' ) #NEWLINE# for ( alias , index ) in aliases : #NEWLINE# #INDENT# print ( "'{0}' rebuilt and aliased to '{1}'" . format ( alias , index ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'You chose not to rebuild indices.' )