IDN Query to get multiple accounts in single source

Hi All,

Need help with a query to get identities having multiple accounts from a specific source.

Hi @maheshtare,

Feel free to refer to the following post on Get Users With More Than One Account in the Same Source as it solves your requirements.

Hope this helps!

Hi Kartik,

We are able to get the all the identities that have multiple accounts in all the sources using below body in search API.

{
    "query": {
        "query": "*"
    },
    "indices": [
        "identities"
    ],
    "aggregationsDsl": {
        "accounts": {
            "nested": {
                "path": "accounts"
            },
            "aggs": {
                "source_id": {
                    "terms": {
                        "field": "accounts.source.id",
                        "min_doc_count": 2,
                        "size": 1000
                    },
                    "aggs": {
                        "identities": {
                            "terms": {
                                "field": "_id",
                                "min_doc_count": 2
                            },
                            "aggs": {
                                "accounts": {
                                    "top_hits": {}
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

However, how can we restrict the output to the specific source. Can you please help

Hi @maheshtare,

For non-authoritative sources, I would suggest using the following request body in the comment here.

Thanks Kartik. We are getting the response as expected.

However, the response we are getting has lot more data than we need. :frowning:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.