How to make dynamic document id from name of the json file

The full path. If you just want the filename part then you can extract it by copying path to another field and using mutate+gsub on that.