def search(self, query, indices=None, doc_types=None, model=None, scan=False, headers=None, **query_params):
if isinstance(query, Search):<EOL><INDENT>search = query<EOL><DEDENT>elif isinstance(query, (Query, dict)):<EOL><INDENT>search = Search(query)<EOL><DEDENT>else:<EOL><INDENT>raise InvalidQuery("<STR_LIT>")<EOL><DEDENT>if scan:<EOL><INDENT>query_params.setdefault("<STR_LIT>", "<STR_LIT>")<EOL>query_params.setdefault("<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>return ResultSet(self, search, indices=indices, doc_types=doc_types,<EOL>model=model, query_params=query_params, headers=headers)<EOL>
Execute a search against one or more indices to get the resultset.

        `query` must be a Search object, a Query object, or a custom
        dictionary of search parameters using the query DSL to be passed
        directly.