def get_unique_pairs(es):
    """ Query to directly get matching pairs of PS nodes.
    
    Args:
        es (Elasticsearch object): Current elasticsearch connection object.
    
    Returns:
        dict: An double aggregation of sources and corresponding destinations.
        
    """
    query = {
        "query": {
            "bool": {
                "filter": [
                    {
                        "range": {
                            "n_hops.avg": {
                                "gt": 1
                            }
                        }
                    },
                    {
                        "range": {
                            "n_hops.value_count": {
                                "gt": 1000
                            }
                        }
                    }
                ]
            }
        },
        "aggs": {
            "sources": {
                "terms": {
                    "field": "src",
                    "size": 60
                },
                "aggs": {
                    "destinations": {
                        "terms": {
                            "field": "dest", 
                            "size": 59
                        }
                    }
                }
            }
        }
    }
    
    try:
        return es.search(index="trace_derived_v2", body=query)
    except Exception as e:
        print(e)