oceandb_elasticsearch_driver/plugin.py
def text_query(self, search_model: FullTextModel):
        """Query elasticsearch for objects.
        :param search_model: object of FullTextModel
        :return: list of objects that match the query.
        """
        self.logger.debug('elasticsearch::text_query::{}'.format(search_model.text))
        if search_model.sort is not None:
            self._mapping_to_sort(search_model.sort.keys())
            sort = self._sort_object(search_model.sort)
        else:
            sort = [{"service.metadata.curation.rating": "asc"}]
        body = {
            '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=search_model.text
        )

        object_list = []
        for x in page['hits']['hits']:
            object_list.append(x['_source'])
        return object_list
def text_query(self, search_model: FullTextModel):
        """Query elasticsearch for objects.
        :param search_model: object of FullTextModel
        :return: list of objects that match the query.
        """
        self.logger.debug('elasticsearch::text_query::{}'.format(search_model.text))
        if search_model.sort is not None:
            self._mapping_to_sort(search_model.sort.keys())
            sort = self._sort_object(search_model.sort)
        else:
            sort = [{"service.metadata.curation.rating": "asc"}]
        body = {
            '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=search_model.text
        )

        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 FullTextModel
        :return: list of objects that match the query.