def update_index(index_name):
    from app.main.services.search_service import create_index
    with application.app_context():
        application.logger.info("Creating index %s", index_name)
        message, status = create_index(index_name)
    assert status == 200, message
    application.logger.info("Created index %s", index_name)
def create(index_name):
    create_type = get_json_from_request('type')
    if create_type == 'index':
        result, status_code = create_index(index_name)
    elif create_type == 'alias':
        alias_target = get_json_from_request('target')
        result, status_code = create_alias(index_name, alias_target)
    else:
        abort(400, "Unrecognized 'type' value. Expected 'index' or 'alias'")

    return api_response(result, status_code)
def create(index_name):
    create_type = get_json_from_request('type')
    if create_type == 'index':
        result, status_code = create_index(index_name)
    elif create_type == 'alias':
        alias_target = get_json_from_request('target')
        result, status_code = create_alias(index_name, alias_target)
    else:
        abort(400, "Unrecognized 'type' value. Expected 'index' or 'alias'")

    return api_response(result, status_code)
def create(index_name):
    result, status_code = create_index(index_name)

    return jsonify(message=result), status_code
def update_index(index_name):
    from app.main.services.search_service import create_index
    with application.app_context():
        message, status = create_index(index_name)
    assert status == 200, message
    application.logger.info("Created index %s", index_name)