def index_all ( self , index_name ) : oks = 0 notoks = 0 for ok , item in streaming_bulk ( self . es_client , self . _iter_documents ( index_name ) ) : if ok : oks += 1 else : notoks += 1 logging . info ( "Import results: %d ok, %d not ok" , oks , notoks )
python3 get document count in index elasticsearch
Index all available documents using streaming_bulk for speed Args :
def index_all(self, index_name):
        """Index all available documents, using streaming_bulk for speed
        Args:

        index_name (string): The index
        """
        oks = 0
        notoks = 0
        for ok, item in streaming_bulk(
            self.es_client,
            self._iter_documents(index_name)
        ):
            if ok:
                oks += 1
            else:
                notoks += 1
        logging.info(
            "Import results: %d ok, %d not ok",
            oks,
            notoks
        )