def add_query_kwargs(kwargs, visitor, constraints, index):
    """ Construct KeyConditionExpression and FilterExpression """
    query_const, filter_const = constraints.remove_index(index)
    kwargs['key_condition_expr'] = query_const.build(visitor)
    if filter_const:
        kwargs['filter'] = filter_const.build(visitor)
    if index.name != 'TABLE':
        kwargs['index'] = index.name
