Modify core storage of Elastic search

I want to encrypt data the Elastic search stores. So basically i want to encrypt using different keys per index. If i use S3 as file system then i can use S3s encryption at rest support.

Coming back to my main question:
Can you point me out to the code where ES writes to filesystem?