N1ql query Optimization

select d.* from data d
where d.type_= ‘Pol’ AND
ANY client IN d.clients

SATISFIES client.id IN (select raw id from data where type_= ‘Customer’ and contactDetails.EMAIL.value= $emailId limit 1) END ",

can we optimized above query?

please help me out its urgent

Subquery results are not available. So Hard to optimize IN with subquery. Run as two queries. Run sub qurey first and then pass in results as query parameter.