def query(self, search_model: QueryModel):
        """Query elasticsearch for objects.
        :param search_model: object of QueryModel.
        :return: list of objects that match the query.
        """
        query_parsed = query_parser(search_model.query)
        self.logger.debug(f'elasticsearch::query::{query_parsed[0]}')
        if search_model.sort is not None:
            self._mapping_to_sort(search_model.sort.keys())
            sort = self._sort_object(search_model.sort)
        else:
            sort = [{"_id": "asc"}]
        if search_model.query == {}:
            query = {'match_all': {}}
        else:
            query = query_parsed[0]

        body = {
            'query': query,
            'sort': sort,
            'from': (search_model.page - 1) * search_model.offset,
            'size': search_model.offset,
        }

        page = self.driver._es.search(
            index=self.driver._index,
            doc_type='_doc',
            body=body,
            q=query_parsed[1]
        )

        object_list = []
        for x in page['hits']['hits']:
            object_list.append(x['_source'])
        return object_list
Query elasticsearch for objects.
        :param search_model: object of QueryModel.
        :return: list of objects that match the query.