(self)
return search_obj
Returns a search object from a template.
Returns a search object from a template.
Returns a search object from a template .
def to_search(self):
        """Returns a search object from a template."""
        if not self._resource_id:
            raise ValueError(
                'Unable to get a search object unless it is tied to a '
                'template.')

        if not self._sketch_id:
            raise ValueError(
                'Unable to get a search object unless it is tied to '
                'a sketch.')

        data = self.lazyload_data(refresh_cache=True)
        objects = data.get('objects')
        if not objects:
            raise ValueError(
                'Unable to get search object, issue with retrieving '
                'template data.')

        template_dict = objects[0]
        sketch = self.api.get_sketch(self._sketch_id)

        search_obj = search.Search(sketch=sketch)
        search_obj.from_manual(
            query_string=template_dict.get('query_string'),
            query_dsl=template_dict.get('query_dsl'),
            query_filter=template_dict.get('query_filter'))
        search_obj.name = template_dict.get('name', 'No Name')
        search_obj.description = template_dict.get(
            'description', 'No Description')
        return search_obj
def to_search ( self ) : if not self . _resource_id : raise ValueError ( 'Unable to get a search object unless it is tied to a ' 'template.' ) if not self . _sketch_id : raise ValueError ( 'Unable to get a search object unless it is tied to ' 'a sketch.' ) data = self . lazyload_data ( refresh_cache = True ) objects = data . get ( 'objects' ) if not objects : raise ValueError ( 'Unable to get search object, issue with retrieving ' 'template data.' ) template_dict = objects [ 0 ] sketch = self . api . get_sketch ( self . _sketch_id ) search_obj = search . Search ( sketch = sketch ) search_obj . from_manual ( query_string = template_dict . get ( 'query_string' ) , query_dsl = template_dict . get ( 'query_dsl' ) , query_filter = template_dict . get ( 'query_filter' ) ) search_obj . name = template_dict . get ( 'name' , 'No Name' ) search_obj . description = template_dict . get ( 'description' , 'No Description' ) return search_obj