Compare 2 tables with different indices and display the records that are missing in first table

How to compare 2 tables with different indices and display the records that are missing in first table.

example:
table 1 table 2 result
A A B
B Y X
X Z
Y
Z

In a distributed system holding large amounts of data that would be very expensive. There is no built in support for this so you need to create an application or a script to do this kind of analysis.

Could you please provide sample scripts or any reference URL.

I do not have any examples. If you have large data volumes this is going to be slow and expensive so is something I do not think is done often. Why do you need to do this? What is the size of the data set?

we have around 25 thousand records in each indices.

Then you might be able to retrieve all docs in a script and compare in memory?