Getting count of matching elements via Query API

Please consider the following Query API call

{“start-query”: {
“foreach”: “parents/parent/childs/child-data[param=‘child-element’]”,
“select”: [
{
“label”: “mac address”,
“expression”: “mac-address”,
“result-type”: [“string”]
}
]
}
}

I am able to query and get the results for matching elements but instead of retrieving the results I want to get the count of matching elements.

This might be what you are looking for

{“start-query”: {
“foreach”: “parents/parent”,
“select”: [
{
“label”: “count”,
“expression”: “count(parents/parent/childs/child-data[param=‘child-element’])”,
“result-type”: [“string”]
}
]
}