How to get total term frequency within a document

i am writing java code for getting total term frequency(number of times a
term occured within a document).
please help me to write this.

here is the document that i inserted into elastic search index.
"resp_aaa_error":[
{"edi_location":"Payer","error_code":"45","followup_action_code":"R"},
{"edi_location":"Payer
ID","error_code":"45","followup_action_code":"R"},
{"edi_location":"Dependent
ID","error_code":"45","followup_action_code":"R"},
{"edi_location":"Subscriber
ID","error_code":"45","followup_action_code":"R"}
]
but when i count how many no of times error_code is equal to 45, it
returns 1.
but i want it to return 4 as it is 4 times in my document.

please help me. it's kind of urgent.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c7606ef4-7876-468e-90ac-2905cfef7eb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.