I am new to elastic search .i have to index data(half million entries) available in text file. i don't understand how i have to start doing it
Did you look at Logstash or Filebeat already?
Other options would include writing code to parse the file and send separate index requests/ bulk index requests to ES. However I've found using one of the two options above much faster in terms of development time needed in the past.
Hope this helps,
Adding to Isabel's answer that if it's non structured data (well, just text), you can have a look at FSCrawler project.