IDs of indexes that doesnt exists

Hi, I have IDs of indexes that doesnt exists.
When I run the folowing painless code in scripted fields I have many IDs that return empty strings, something that shouldn happen because in all my indexes I have a field called "server".

if (doc.containsKey('server.keyword')) {
  return doc['server.keyword'].value;
} else {
  return '';
}

I had copy the IDs that returns empty strings and look up for it in discover filters, and discover tell me that "No results match your search criteria"

Where this "ghost" IDs come from? deleted indexes?, what can I do to get rid of them?

I'm not entirely sure, and I'd have to see your full query, and probably look at your dataset. But if you want to only process documents that have a value for server.keyword, it seems you should filter on that, no?