<s> from esrally . track import track <EOL> GEO_NAMES_INDEX_NAME = "<STR_LIT>" <EOL> GEO_NAMES_TYPE_NAME = "<STR_LIT:type>" <EOL> class DefaultQuery ( track . Query ) : <EOL> def __init__ ( self ) : <EOL> track . Query . __init__ ( self , "<STR_LIT:default>" ) <EOL> def run ( self , es ) : <EOL> return es . search ( index = GEO_NAMES_INDEX_NAME ) <EOL> class TermQuery ( track . Query ) : <EOL> def __init__ ( self ) : <EOL> track . Query . __init__ ( self , "<STR_LIT>" ) <EOL> def run ( self , es ) : <EOL> return es . search ( index = GEO_NAMES_INDEX_NAME , doc_type = GEO_NAMES_TYPE_NAME , q = "<STR_LIT>" ) <EOL> class PhraseQuery ( track . Query ) : <EOL> def __init__ ( self ) : <EOL> track . Query . __init__ ( self , "<STR_LIT>" ) <EOL> def run ( self , es ) : <EOL> return es . search ( index = GEO_NAMES_INDEX_NAME , doc_type = GEO_NAMES_TYPE_NAME , body = '''<STR_LIT>''' ) <EOL> class CountryAggQuery ( track . Query ) : <EOL> def __init__ ( self , suffix = "<STR_LIT>" , use_request_cache = True ) : <EOL> track . Query . __init__ ( self , "<STR_LIT>" + suffix ) <EOL> self . use_request_cache = use_request_cache <EOL> def run ( self , es ) : <EOL> return es . search ( index = GEO_NAMES_INDEX_NAME , doc_type = GEO_NAMES_TYPE_NAME , <EOL> request_cache = self . use_request_cache , body = '''<STR_LIT>''' ) <EOL> class ScrollQuery ( track . Query ) : <EOL> PAGES = <NUM_LIT> <EOL> ITEMS_PER_PAGE = <NUM_LIT:1000> <EOL> def __init__ ( self ) : <EOL> track . Query . __init__ ( self , "<STR_LIT>" , normalization_factor = self . PAGES ) <EOL> self . scroll_id = None <EOL> def run ( self , es ) : <EOL> r = es . search ( <EOL> index = GEO_NAMES_INDEX_NAME , <EOL> doc_type = GEO_NAMES_TYPE_NAME , <EOL> sort = "<STR_LIT>" , <EOL> scroll = "<STR_LIT>" , <EOL> size = self . ITEMS_PER_PAGE ) <EOL> self . scroll_id = r [ "<STR_LIT>" ] <EOL> for i in range ( self . PAGES - <NUM_LIT:1> ) : <EOL> hit_count = len ( r [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) <EOL> if hit_count == <NUM_LIT:0> : <EOL> break <EOL> r = es . scroll ( scroll_id = self . scroll_id , scroll = "<STR_LIT>" ) <EOL> def close ( self , es ) : <EOL> if self . scroll_id : <EOL> es . clear_scroll ( scroll_id = self . scroll_id ) <EOL> self . scroll_id = None <EOL> geonamesTrackSpec = track . Track ( <EOL> name = "<STR_LIT>" , <EOL> short_description = "<STR_LIT>" , <EOL> description = "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> source_root_url = "<STR_LIT>" , <EOL> index_name = GEO_NAMES_INDEX_NAME , <EOL> type_name = GEO_NAMES_TYPE_NAME , <EOL> number_of_documents = <NUM_LIT> , <EOL> compressed_size_in_bytes = <NUM_LIT> , <EOL> uncompressed_size_in_bytes = <NUM_LIT> , <EOL> document_file_name = "<STR_LIT>" , <EOL> mapping_file_name = "<STR_LIT>" , <EOL> queries = [ <EOL> DefaultQuery ( ) , <EOL> TermQuery ( ) , <EOL> PhraseQuery ( ) , <EOL> CountryAggQuery ( use_request_cache = False ) , <EOL> CountryAggQuery ( suffix = "<STR_LIT>" , use_request_cache = True ) , <EOL> ScrollQuery ( ) <EOL> ] , <EOL> track_setups = track . track_setups <EOL> ) </s>
