Complex inner query

Need help to create proper query for search, currently using Java API, even without java can't figure out how to do it wit elastic.

for example:
i have two indexes followers and followings. each of them has same document model:
{ id:0, accountId:0, targetAccountId:0, targetName:String }

i want to make search by name which searches into my followings index, next my followers index, next into followings of my followings and followesr of my followers.
if found 20 records stop;

most embarrassing part is how to search in a single query all of this;
i started searching in my follower and following documents name "John Doe" notthing found, how to tell elastic to continue searching into followers/followings of my followers/followings.


Hey @Tornike_Tarimanishvi, are you using Elasticsearch or Elastic App Search?