# How to get keywords' tf-idf score across an index?

**URL:** https://discuss.elastic.co/t/how-to-get-keywords-tf-idf-score-across-an-index/38167
**Category:** Elasticsearch
**Created:** [December 30, 2015, 10:51am UTC](https://discuss.elastic.co/t/how-to-get-keywords-tf-idf-score-across-an-index/38167 "2015-12-30T10:51:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![no\_jihun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/no_jihun/32/64028_2.png) [@no\_jihun](https://discuss.elastic.co/u/no_jihun)
#### Post date: [December 30, 2015, 10:51am UTC](https://discuss.elastic.co/t/how-to-get-keywords-tf-idf-score-across-an-index/38167/1 "2015-12-30T10:51:09Z")

</div>

Hello.

I wonder is there a way to get IDF score of some keywords across an index?

for example, let us imagine an index which 100 docs indexed.

Now I have keyword set extracted from sentence something like "computer, engineering, database, optimizing, btree".

then I want to calculate which keyword is most adoptable tag of that sentance.  
for example : btree 0.9 , database 0.5

is this possible in elasticsearch?  
or could you please advice any alternatives?

i know I can query by each keyword then get the result count.  
but it is inefficient if keyword set's size is large.

thanks.

---

<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:27pm UTC](https://discuss.elastic.co/t/how-to-get-keywords-tf-idf-score-across-an-index/38167/2 "2017-07-05T23:27:51Z")

</div>


