Why Elasticsearch delete repository API only removes reference

I am using Elasticsearch API to delete the Elasticsearch repository and Elasticsearch locations. But in both cases, Physical folders remain intact in the file system.
I read in the documentation that delete API only removes the references and keeps the physical files untouched.
Why Elasticsearch does not delete the repository/location from the physical location?
Does it expect clients to do it?
Are there any APIs available from Elastic to delete the repository and location from the file system?

Welcome!

Removing a repository does not remove the snapshots.

So you need to remove the snapshots first and then you can remove the repository.

ok, sure. So, if I remove the snapshot first and then remove the repository will it delete the repository from the file system as well?

It won't cleanup everything as I believe that some few metadata files might still exist.

But what are you trying to solve?

I need to delete the repository/location folder from the file system after the repository/location is deleted from Elasticsearch.
But like you said, Elastic leaves some metadata files. So, could it be useful in the future? Should I be worried before deleting the folder from the file system manually?

Just rm -r the dir and you'll be done.

Sure, Thanks for the help @dadoonet.