I have maven project of elasticsearch in eclipse I want to know that which java classes should I go through to understand working of shards properly.(How data is stored in shards during indexing and how snapshot work at shards level).
This is a broad question as shards are not that simple. An Elasticsearch shard is an Apache Lucene instance, which is not such an easy piece of software to understand either. If you are eager to learn about how elasticsearch works, I would really recommend to start by reading the book about Elasticsearch, which already contains in-depth information about how shards work: https://www.elastic.co/guide/en/elasticsearch/guide/master/index.html