async def METHOD_NAME(self, query, offset, length, metadata=None):
    response_txt = None
    return_obj = dict()
    try:
        # extract the max_result_window from elasticsearch
        if not self.max_result_window:
            self.max_result_window = await self.get_pagesize(DEFAULT_MAX_RESULTS_WINDOW_SIZE)
        # using search after API in ElasticSearch
        # pass the last searched value in metadata argument, ignore offset argument
        response = await self.api_client.search_pagination(query, metadata, min(int(length), self.max_result_window))
        return_obj = self._handle_errors(response, return_obj)
        if (return_obj['success']):
            response_json = json.loads(return_obj["data"])
            if response_json['hits']:
                # and (response_json['hits']['total']['value'] >= 0 or response_json['hits']['total'] >= 0):
                self.logger.error("Total # of hits:" + str(response_json['hits']['total']))
                return_obj['data'] = [record['_source'] for record in response_json["hits"]["hits"]]
                self.logger.error("Total # of records: " + str(len(return_obj['data'])))
                if len(response_json["hits"]["hits"]) == 0:
                    return_obj['metadata'] = metadata
                elif 'sort' in response_json["hits"]["hits"][-1]:
                    return_obj['metadata'] = response_json["hits"]["hits"][-1]['sort']
        return return_obj
    except Exception as e:
        if response_txt is not None:
            ErrorResponder.fill_error(return_obj, message='unexpected exception', connector=self.connector)
            self.logger.error('can not parse response: ' + str(response_txt))
        else:
            raise e