Query Sequencing

Hi All,

I believe this problem is solved before but couldn't find it in google search or in this forum. If my problem can be solved differently please help me to understand that.

I have 4 different queries, Q1, Q2, Q3, Q4. I have to run these queries in sequence based on I get a result for each of the query. The sequence logic goes something like this,

result1 = run(Q1);

if ( result1. count == 0 )
    result2 = run(Q2);

    if ( result2.count == 0)


I checked the boolean query and filters but doesn't quite fit in to what we wanted to do. But I found out that I can run multiple queries in parallel using muti search APIs. I can use that to run it in parallel and check the results but it seems like a overkill.

Hope I am making sense. Please let me know a good solution.