Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 01-25-2023 12:21 AM
Hello guys,
Can someone please help me, how I can write a solr query where results to be grouped on one field (text type) and sum on another field. Here is my documents results:
{
"responseHeader": {
"zkConnected": true,
"status": 0,
"QTime": 30,
"params": {
"q": "*:*",
"doAs": "knoxui",
"fl": "access, agent, repo, resource, resType, event_count",
"fq": [
"access:read",
"repo:cm_ozone",
"resType:key",
"action:read"
],
"_forwardedCount": "1",
"_": "1674633786010"
}
},
"response": {
"numFound": 8,
"start": 0,
"docs": [
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1/dir2/dir3",
"resType": "key",
"event_count": 1
},
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1",
"resType": "key",
"event_count": 1
},
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1/test3.txt",
"resType": "key",
"event_count": 1
},
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1/dir2",
"resType": "key",
"event_count": 1
},
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1/dir2/dir3",
"resType": "key",
"event_count": 1
},
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1",
"resType": "key",
"event_count": 1
},
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1/test3.txt",
"resType": "key",
"event_count": 1
},
{
"access": "read",
"agent": "ozone",
"repo": "cm_ozone",
"resource": "volume1/fso-bucket/dir1/dir2",
"resType": "key",
"event_count": 1
}
]
}
}
Here I need something like equivalent to SQL:
select resource, count(event_count) from <docs> group by resource;
Created 01-25-2023 01:05 AM
Ok guys, I figured this out myself:
Created 01-25-2023 01:05 AM
Ok guys, I figured this out myself: