def get_filtered_query(must_list=None, must_not_list=None):
    """Get the correct query string for a boolean filter. Accept must and
    must_not lists. Use MatchList for generating the appropriate lists.
    """
    bool_filter = {}
    if must_list:
        bool_filter['must'] = must_list
    if must_not_list:
        bool_filter['must_not'] = must_not_list
    result = {
        'query': {
            'filtered': {
                'filter': {
                    'bool': bool_filter
                }
            }
        }
    }
    return result