Doc count with Path Hierarchy

A index doc can belongs to multiple group (path) and i aggregated search result based on group like below:

below doc have two path as you can see in nested structure:

"NavigationCollection": [
{
"LangId": 1,
"Path": "Test1>Test2>Test3>Test4>Test5"
},

                    {
                        "LangId": 1,
                        "Path": "Test1>Test2>Test3>"
                    }
                ]

when i run aggregate query:

"aggs": {
"NavCollection": {
"nested": {
"path": "NavigationCollection"
},
"aggs": {
"langid": {
"filter": {
"term": {
"NavigationCollection.LangId": "1"
}
},
"aggs": {
"catpath": {
"terms": {
"field": "NavigationCollection.Path",
"size": 50
}
}
}
}
}
}

it returns data like below :
Test1 - doc count 2
Test2 - doc count 2
Test3 - doc count 2
Test4 - doc count 1
Test5 - doc count 1

actually these all are pointing to single records. i am expecting a output like below
Test1 - doc count 1
Test2 - doc count 1
Test3 - doc count 1
Test4 - doc count 1
Test5 - doc count 1

please help me on this.

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