# TermsStatsFacets

**URL:** <https://discuss.elastic.co/t/termsstatsfacets/3967>\
**Category:** Elasticsearch\
**Created:** [February 23, 2011, 4:04pm UTC](https://discuss.elastic.co/t/termsstatsfacets/3967 "2011-02-23T16:04:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [February 23, 2011, 4:04pm UTC](https://discuss.elastic.co/t/termsstatsfacets/3967/1 "2011-02-23T16:04:37Z")

</div>

Hi,

the filter is not recognized in the TermsStatsFacets \*\* this is a bug  
I guess.

One more question: when using "doc.score" the result for my data is a  
bit disappointing. E.g. when no query string is specified all docs  
have score == 1 ... so, is it possible to access the document position  
in the result and use it within the script?

I would like to give values which comes 'more earlier' in the result a  
greater influence and sort the facets against that. This way when the  
user sorts the result also the facets will be reordered and show  
probably more meaningful values.

Regards,  
Peter.

\*\*

> <https://gist.github.com/karussell/840447>

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 23, 2011, 5:39pm UTC](https://discuss.elastic.co/t/termsstatsfacets/3967/2 "2011-02-23T17:39:18Z")

</div>

On Wednesday, February 23, 2011 at 6:04 PM, Karussell wrote:  
Hi,

> the filter is not recognized in the TermsStatsFacets \*\* this is a bug  
> I guess.  
> Pushed a fix, it was not added when using the Java API.
> 
> One more question: when using "doc.score" the result for my data is a  
> bit disappointing. E.g. when no query string is specified all docs  
> have score == 1 ... so, is it possible to access the document position  
> in the result and use it within the script?  
> Document position does not mean much with the way Lucene works. You can access a timestamp and work with it if you have it.
> 
> I would like to give values which comes 'more earlier' in the result a  
> greater influence and sort the facets against that. This way when the  
> user sorts the result also the facets will be reordered and show  
> probably more meaningful values.
> 
> Regards,  
> Peter.
> 
> \*\*  
> [TermsStatsFacetsShouldAllowFilter.java · GitHub](https://gist.github.com/840447)

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [February 23, 2011, 6:46pm UTC](https://discuss.elastic.co/t/termsstatsfacets/3967/3 "2011-02-23T18:46:08Z")

</div>

thanks \* 2 🙂

timestamp is a good hint

On 23 Feb., 18:39, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> On Wednesday, February 23, 2011 at 6:04 PM, Karussell wrote:
> 
> Hi,
> 
> > the filter is not recognized in the TermsStatsFacets \*\* this is a bug  
> > I guess.
> 
> Pushed a fix, it was not added when using the Java API.
> 
> > One more question: when using "doc.score" the result for my data is a  
> > bit disappointing. E.g. when no query string is specified all docs  
> > have score == 1 ... so, is it possible to access the document position  
> > in the result and use it within the script?
> 
> Document position does not mean much with the way Lucene works. You can access a timestamp and work with it if you have it.

---

<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, 4:11am UTC](https://discuss.elastic.co/t/termsstatsfacets/3967/4 "2017-07-06T04:11:38Z")

</div>


