Esempio n. 1
0
 def handle(self, *args, **kwargs):
     list_all = kwargs.get('all')
     
     elastic = ES(settings.SEARCH_HOSTS)
     indices = elastic.cluster_state()['metadata']['indices']
     listing = []
     
     for key in indices.keys():
         listing.extend([key])
         
         if list_all:
             listing.extend(indices[key]['aliases'])
             
     for item in sorted(listing):
         self.stdout.write(item + "\n")
         
     elastic.connection.close()