async def scan(self) -> AsyncIterator[_R]:
        """
        Turn the search into a scan search and return a generator that will
        iterate over all the documents matching the query.

        Use the ``params`` method to specify any additional arguments you wish to
        pass to the underlying ``scan`` helper from ``elasticsearch-py`` -
        https://elasticsearch-py.readthedocs.io/en/latest/helpers.html#scan

        The ``iterate()`` method should be preferred, as it provides similar
        functionality using an Elasticsearch point in time.
        """
        es = get_connection(self._using)

        async for hit in async_scan(
            es, query=self.to_dict(), index=self._index, **self._params
        ):
            yield self._get_result(cast(AttrDict[Any], hit))

        Turn the search into a scan search and return a generator that will
        iterate over all the documents matching the query.

        Use the ``params`` method to specify any additional arguments you wish to
        pass to the underlying ``scan`` helper from ``elasticsearch-py`` -
        https://elasticsearch-py.readthedocs.io/en/latest/helpers.html#scan

        The ``iterate()`` method should be preferred, as it provides similar
        functionality using an Elasticsearch point in time.
        
elasticsearch/dsl/_async/search.py