# Document frequency of phrases

**URL:** https://discuss.elastic.co/t/document-frequency-of-phrases/21104
**Category:** Elasticsearch
**Created:** [December 5, 2014, 12:35pm UTC](https://discuss.elastic.co/t/document-frequency-of-phrases/21104 "2014-12-05T12:35:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Yingkai\_Gao\_2](https://avatars.discourse-cdn.com/v4/letter/y/7ea924/32.png) [@Yingkai\_Gao\_2](https://discuss.elastic.co/u/Yingkai_Gao_2)
#### Post date: [December 5, 2014, 12:35pm UTC](https://discuss.elastic.co/t/document-frequency-of-phrases/21104/1 "2014-12-05T12:35:09Z")

</div>

I am implementing a model called sequential dependency model in  
ElasticSearch using dynamic script, and I need to get the collection  
frequency (shard frequency in ES) of a phrase. It is possible to get the  
term frequency of phrase by comparing the positions of each term in the  
phrase, but how could I get collection frequency or document frequency of  
phrases? If it is possible, how could I get the collection frequency of  
two sloppy near terms?

I guess one solution is to extend a Lucene similarity class. However, can  
I do this just using dynamic script?

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/fe9dcc76-75b8-4e57-9ade-26134b703e57%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fe9dcc76-75b8-4e57-9ade-26134b703e57%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:45am UTC](https://discuss.elastic.co/t/document-frequency-of-phrases/21104/2 "2017-07-06T00:45:34Z")

</div>


