#NEWLINE# def load_tasks( self , status , project = None , fields = None ) : #NEWLINE# #INDENT# self . refresh ( ) #NEWLINE# if ( project is None ) : #NEWLINE# #INDENT# for project in self . projects : #NEWLINE# #INDENT# for each in self . load_tasks ( status , project , fields ) : #NEWLINE# #INDENT# ( yield each ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for record in elasticsearch . helpers . scan ( self . es , index = self . index , doc_type = self . __type__ , query = { #NEWLINE# #INDENT# 'query' : { #NEWLINE# #INDENT# 'bool' : { #NEWLINE# #INDENT# 'must' : { #NEWLINE# #INDENT# 'term' : { #NEWLINE# #INDENT# 'project' : project , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# 'should' : [ { #NEWLINE# #INDENT# 'term' : { #NEWLINE# #INDENT# 'status' : status , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'minimum_should_match' : 1 , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , _source_include = ( fields or [ ] ) ) : #NEWLINE# #INDENT# ( yield self . _parse ( record [ '_source' ] ) )