How to store .pdf or .txt file and search in it using Java

I took help from this post
https://discuss.elastic.co/t/how-to-index-and-store-pdf-file-in-elastic-search-using-spring-boot/220289/46