Elastic search multiple queries issue

I have 1 lakh individual names in one particular doc_type
{
"name":"abc",
"country":"Germany"
}
and so on.

I receive 50k names from a REST Api, but then to fetch country of these names I have to query ES 50K times which took lot of time and IO on servers.
Also I need to filter the names based on country.
For Ex. only Germany people to extract from 50K names.

Any better way to write such query.

Why not just filter on the country and then match that against the list of names?
You'd have to do the second part in your code though, there's no way to do that in ES.

1 Like

Hi,

Thanks for that. It really is the solution that we can try.
But this require processing on back-end, can we give ES an array of names and the ES could return json with name and country. Is this sort of queries supported in ES.

As long as the index has the user name and the country in the same document, yes.

Yes thanks that worked for me.