# Introduce additional frequency metric other than term frequency

**URL:** https://discuss.elastic.co/t/introduce-additional-frequency-metric-other-than-term-frequency/42991
**Category:** Elasticsearch
**Created:** [February 29, 2016, 10:52am UTC](https://discuss.elastic.co/t/introduce-additional-frequency-metric-other-than-term-frequency/42991 "2016-02-29T10:52:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mahathi\_bhagavatula](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mahathi\_bhagavatula](https://discuss.elastic.co/u/mahathi_bhagavatula)
#### Post date: [February 29, 2016, 10:52am UTC](https://discuss.elastic.co/t/introduce-additional-frequency-metric-other-than-term-frequency/42991/1 "2016-02-29T10:52:40Z")

</div>

I want to introduce additional frequency metric on top of term  
frequency at index time. The frequency metric is calculated based on the  
term-document matrix.

I tried overriding DefaultSimilarity.Java. The class contains the  
term frequency, document frequency information. But, the mapping of the  
term frequency to the term and document is missing in that class.

I tried using ScoreFunctionBuilder.Java to modify the scoring at  
query time. But, the score is independent of term-frequency and only  
depends on the modified scoring logic.

I want the exact class which calculates the term frequency and  
document frequency and can we override the class using a plugin. Kindly  
help me out on this issue.

Also, the inference from Mastering Elasticsearch Guide book is that  
term frequency is calculated and stored at the time of Indexing. If this  
is correct, please let me know the class which calculates the term  
frequency at the time of Indexing. Also correct me if I am wrong.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 11:12pm UTC](https://discuss.elastic.co/t/introduce-additional-frequency-metric-other-than-term-frequency/42991/2 "2017-07-05T23:12:53Z")

</div>


