def run_query()

in src/es_pii_tool/redacters/index.py [0:0]


    def run_query(self):
        """Run the query"""
        self.data.result = DotMap(
            dict(
                api.do_search(
                    self.task.job.client,
                    self.index,
                    self.task.job.config['query'],
                    size=10000,
                )
            )
        )
        self.data.hits = self.data.result.hits.total.value
        logger.debug('Checking document fields on index: %s...', self.index)
        if self.data.hits == 0:
            self.counter += 1
            msg = f'Documents matching redaction query not found on index: {self.index}'
            logger.debug(msg)
            msg = f'Index {self.counter} of {self.task.job.total} processed...'
            logger.info(msg)
            # Record success for this task but send msg to the log field
            # An index could be in the pattern but have no matches.
            self.task.end(True, logmsg=msg)
        self.task.add_log(f"Hits: {self.data.hits}")