Reputation: 309
I have collection with data like:
"docs":[
{"EventDate":"2019-01-29T00:03Z",
"type":"Request",
"RqID":"00000000000000000000000000000001"},
{"EventDate":"2019-01-29T00:04Z",
"type":"Response",
"RqID":"00000000000000000000000000000001"},
{"EventDate":"2019-01-29T01:45Z",
"type":"Request",
"RqID":"00000000000000000000000000000002"},
{"EventDate":"2019-01-29T01:45Z",
"type":"Response",
"RqID":"00000000000000000000000000000002"},
]
I want to calculate "Response-Request" time. At SQL I did this by:
select rq, t2.EventType-t1.EventType from table t1, table t2
where t1.RqID = t2.RqID
and t1.type = 'Request'
and t2.type = 'Response'
Join in solr return me not joined docs. How can I do it in Solr?
Upvotes: 2
Views: 101
Reputation: 752
If you would firstly group the data by rqID, and then using the scalar math sub function with EventDate from the Response - EventDate from the Request, you should get the result you're looking for.
Upvotes: 1
Reputation: 309
I can make a join: q=type:"Request"&fl=*,resp[subquery]&resp.q={!term f=RqID v=$row.RqUID}&resp.fq= Response
But I have no idea how to calc duration.
Upvotes: 0