def _split_filter(filter, metadata):
    """
    Split the filter into indx_ops and slow_filters which are later used
    differently

    :param filter {doc_key: query_ops}:
    :param metadata dict:
    :rtype: {doc_key: query_ops}, [(SortedDict idx, dict query_ops), ...]
    """
    slow_filters = {}
    indx_ops = []
    indexes = metadata.get('indexes', {})
    for doc_key, query_ops in filter.items():
        if doc_key + '_1' in indexes:
            indx_ops.append((indexes[doc_key + '_1']['idx'], query_ops))
        elif doc_key + '_-1' in indexes:
            indx_ops.append((indexes[doc_key + '_-1']['idx'], query_ops))
        else:
            slow_filters[doc_key] = query_ops
    return slow_filters, indx_ops