def print_hits(results):
 print_search_stats(results)
 for hit in results['hits']['hits']:
  created_at = parse_date(hit['_source'].get('created_at', hit['_source']['authored_date']))
  print(('/%s/%s/%s (%s): %s' % (hit['_index'], hit['_type'], hit['_id'], created_at.strftime('%Y-%m-%d'), hit['_source']['description'].replace('\n', ' '))))
 print(('=' * 80))
 print()

def print_hits ( results ) : print_search_stats ( results ) for hit in results [ 'hits' ] [ 'hits' ] : created_at = parse_date ( hit [ '_source' ] . get ( 'created_at' , hit [ '_source' ] [ 'authored_date' ] ) ) print ( ( '/%s/%s/%s (%s): %s' % ( hit [ '_index' ] , hit [ '_type' ] , hit [ '_id' ] , created_at . strftime ( '%Y-%m-%d' ) , hit [ '_source' ] [ 'description' ] . replace ( '\n' , ' ' ) ) ) ) print ( ( '=' * 80 ) ) print ( )
simple utility function to print results of a search query .