I am trying to combine 2 searches into one. However, the results for the 2nd search should only return if there are results in the first one.
If no results in the first query, then nothing should be returned. If there are results from the first one, then display the returns from the 2nd search
| where jobName="test_job1" AND statusText in ("FAILURE", "SUCCESS")
| where like(jobName,"test%") AND statusText="FAILURE" | stats earliest(statusText) as FirstFailure, earliest(timestamp) as FirstFailureTime by jobName, machine
| join jobName
[search index=batch | where like(jobName,"test%") | stats latest(statusText) as LatestStatus, latest(timestamp) as LastUpdatedtime by jobName]
| sort by LastUpdatedtime desc