(
            self, name, query_string='', query_dsl='', query_filter=None)
return search_obj
Create a view object.

        Args:
            name (str): the name of the view.
            query_string (str): OpenSearch query string. This is optional
                yet either a query string or a query DSL is required.
            query_dsl (str): OpenSearch query DSL as JSON string. This is
                optional yet either a query string or a query DSL is required.
            query_filter (dict): Filter for the query as a dict.

        Raises:
            ValueError: if neither query_string nor query_dsl is provided or
                if query_filter is not a dict.
            RuntimeError: if a view wasn't created for some reason.

        Returns:
            A search.Search object that has been saved to the database.
Create a view object.
Create a view object .
def create_view(
            self, name, query_string='', query_dsl='', query_filter=None):
        """Create a view object.

        Args:
            name (str): the name of the view.
            query_string (str): OpenSearch query string. This is optional
                yet either a query string or a query DSL is required.
            query_dsl (str): OpenSearch query DSL as JSON string. This is
                optional yet either a query string or a query DSL is required.
            query_filter (dict): Filter for the query as a dict.

        Raises:
            ValueError: if neither query_string nor query_dsl is provided or
                if query_filter is not a dict.
            RuntimeError: if a view wasn't created for some reason.

        Returns:
            A search.Search object that has been saved to the database.
        """
        logger.warning(
            'View objects will be deprecated shortly, use search.Search '
            'and call the search_obj.save() function to save a search.')

        if not (query_string or query_dsl):
            raise ValueError('You need to supply a query string or a dsl')

        if self.is_archived():
            raise RuntimeError('Unable create a view on an archived sketch.')

        search_obj = search.Search(sketch=self)
        search_obj.from_manual(
            query_string=query_string,
            query_dsl=query_dsl,
            query_filter=query_filter
        )
        search_obj.name = name
        search_obj.save()
        return search_obj
def create_view ( self , name , query_string = '' , query_dsl = '' , query_filter = None ) : logger . warning ( 'View objects will be deprecated shortly, use search.Search ' 'and call the search_obj.save() function to save a search.' ) if not ( query_string or query_dsl ) : raise ValueError ( 'You need to supply a query string or a dsl' ) if self . is_archived ( ) : raise RuntimeError ( 'Unable create a view on an archived sketch.' ) search_obj = search . Search ( sketch = self ) search_obj . from_manual ( query_string = query_string , query_dsl = query_dsl , query_filter = query_filter ) search_obj . name = name search_obj . save ( ) return search_obj