merge_machine/api.py
def es_fetch(proj):
    '''
    Fetch result from the existing ES index project_id
    https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html
    
    By default it will paginate based on the document ID order
    
    GET:
        - project_type
        - project_id
    POST:
        - data_params: None
        - module_params:
            - (size): size of sample
            - (from): where to start
            - (field): field to sort on (defaults to "_id", the original file order)
            - (order): "desc" or "asc"
    
    '''
    
    _, module_params = _parse_request()
    
    if module_params is None:
        module_params = {}
    size = module_params.get('size', 10)
    from_ = module_params.get('from', 0)
    field = module_params.get('field', '_id')
    order = module_params.get('order', 'asc')

    # For now only _id and __CONFIDENCE are sortable
    assert field in ['_id', '__CONFIDENCE']
    
    if field == '_id':
        res = proj.fetch_by_id(size, from_, order)
    else:
        res = proj.fetch_by_sort(field, order, size, from_)
    return jsonify(res)

    Fetch result from the existing ES index project_id
    https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html
    
    By default it will paginate based on the document ID order
    
    GET:
        - project_type
        - project_id
    POST:
        - data_params: None
        - module_params:
            - (size): size of sample
            - (from): where to start
            - (field): field to sort on (defaults to "_id", the original file order)
            - (order): "desc" or "asc"
    
    


By default it will paginate based on the document ID order


By default it will paginate based on the document ID order
def es_fetch(proj):
    _, module_params = _parse_request()
    if module_params is None:
        module_params = {}
    size = module_params.get('size', 10)
    from_ = module_params.get('from', 0)
    field = module_params.get('field', '_id')
    order = module_params.get('order', 'asc')
    assert field in ['_id', '__CONFIDENCE']
    if field == '_id':
        res = proj.fetch_by_id(size, from_, order)
    else:
        res = proj.fetch_by_sort(field, order, size, from_)
    return jsonify(res)
def es_fetch ( proj ) : _ , module_params = _parse_request ( ) if module_params is None : module_params = { } size = module_params . get ( 'size' , 10 ) from_ = module_params . get ( 'from' , 0 ) field = module_params . get ( 'field' , '_id' ) order = module_params . get ( 'order' , 'asc' ) assert field in [ '_id' , '__CONFIDENCE' ] if field == '_id' : res = proj . fetch_by_id ( size , from_ , order ) else : res = proj . fetch_by_sort ( field , order , size , from_ ) return jsonify ( res )
Fetch result from the existing ES index project_id
https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html
Fetch result from the existing ES index project_id https : // www . elastic . co / guide / en / elasticsearch / guide / current / pagination . html
'''
    Fetch result from the existing ES index project_id
    https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html
    
    By default it will paginate based on the document ID order
    
    GET:
        - project_type
        - project_id
    POST:
        - data_params: None
        - module_params:
            - (size): size of sample
            - (from): where to start
            - (field): field to sort on (defaults to "_id", the original file order)
            - (order): "desc" or "asc"
    
    ''' # For now only _id and __CONFIDENCE are sortable
proj