Can anyone explain about what is the use of analyzer and why we need to go for that?
Have you had a look at the documentation? If not, I would recommend starting with the following:
https://www.elastic.co/guide/en/elasticsearch/guide/2.x/analysis-intro.html
https://www.elastic.co/guide/en/elasticsearch/reference/5.2/analysis.html#analysis