Exemple #1
0
    def handle(self, *args, **options):
        percent = options['percent']
        delete = options['delete']
        mapping_types = options['mapping_types']
        criticalmass = options['criticalmass']
        seconds_ago = options['seconds_ago']
        seconds_ago += options['minutes_ago'] * 60
        seconds_ago += options['hours_ago'] * 3600
        if mapping_types:
            mapping_types = mapping_types.split(',')
        if not 1 <= percent <= 100:
            raise CommandError('percent should be between 1 and 100')
        if percent < 100 and seconds_ago:
            raise CommandError('you can\'t specify a time ago and percent')
        if criticalmass and seconds_ago:
            raise CommandError(
                'you can\'t specify a time ago and criticalmass')
        if percent < 100 and criticalmass:
            raise CommandError('you can\'t specify criticalmass and percent')
        if mapping_types and criticalmass:
            raise CommandError(
                'you can\'t specify criticalmass and mapping_types')

        es_reindex_cmd(percent=percent,
                       delete=delete,
                       mapping_types=mapping_types,
                       criticalmass=criticalmass,
                       seconds_ago=seconds_ago,
                       log=FakeLogger(self.stdout))
Exemple #2
0
    def handle(self, *args, **options):
        if not args:
            raise CommandError('You must specify which index to delete.')

        es_delete_cmd(args[0],
                      noinput=options['noinput'],
                      log=FakeLogger(self.stdout))
Exemple #3
0
    def handle(self, *args, **options):
        percent = options["percent"]
        delete = options["delete"]
        mapping_types = options["mapping_types"]
        criticalmass = options["criticalmass"]
        seconds_ago = options["seconds_ago"]
        seconds_ago += options["minutes_ago"] * 60
        seconds_ago += options["hours_ago"] * 3600
        if mapping_types:
            mapping_types = mapping_types.split(",")
        if not 1 <= percent <= 100:
            raise CommandError("percent should be between 1 and 100")
        if percent < 100 and seconds_ago:
            raise CommandError("you can't specify a time ago and percent")
        if criticalmass and seconds_ago:
            raise CommandError("you can't specify a time ago and criticalmass")
        if percent < 100 and criticalmass:
            raise CommandError("you can't specify criticalmass and percent")
        if mapping_types and criticalmass:
            raise CommandError("you can't specify criticalmass and mapping_types")

        es_reindex_cmd(
            percent=percent,
            delete=delete,
            mapping_types=mapping_types,
            criticalmass=criticalmass,
            seconds_ago=seconds_ago,
            log=FakeLogger(self.stdout),
        )
Exemple #4
0
    def handle(self, *args, **options):
        pages = options['pages']
        if not args:
            raise CommandError('You must specify the search query.')

        query = u' '.join(args)

        es_search_cmd(query, pages, FakeLogger(self.stdout))
Exemple #5
0
 def handle_label(self, label, **options):
     es_delete_cmd(label,
                   noinput=options["noinput"],
                   log=FakeLogger(self.stdout))
Exemple #6
0
 def handle(self, *args, **options):
     es_verify_cmd(FakeLogger(self.stdout))
Exemple #7
0
 def handle(self, *args, **options):
     es_status_cmd(options["checkindex"], log=FakeLogger(self.stdout))
Exemple #8
0
    def handle(self, *args, **options):
        pages = options['pages']
        query = ' '.join(args)

        es_search_cmd(query, pages, FakeLogger(self.stdout))