# Newbie question about \_terms and filters

**URL:** <https://discuss.elastic.co/t/newbie-question-about--terms-and-filters/2986>\
**Category:** Elasticsearch\
**Created:** [June 1, 2010, 1:18pm UTC](https://discuss.elastic.co/t/newbie-question-about--terms-and-filters/2986 "2010-06-01T13:18:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dominique\_Rose\_Roset](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@Dominique\_Rose\_Roset](https://discuss.elastic.co/u/Dominique_Rose_Roset)\
**Post date:** [June 1, 2010, 1:18pm UTC](https://discuss.elastic.co/t/newbie-question-about--terms-and-filters/2986/1 "2010-06-01T13:18:47Z")

</div>

Hi,

I'm having a hard time figuring how I could retrieve the terms  
belonging to a subset of the indexed documents.

For instance, given a call as such:

curl -XGET "[http://localhost:9200/\_terms?fields=posts.tags](http://localhost:9200/_terms?fields=posts.tags)"

How can I narrow it down to terms corresponding to posts with a  
"status" of "published"? I tried providing a Filtered Query in the  
request body, to no avail. I am doing it wrong (most probably) or is  
it just not possible (yet)?

Dominique Rose-Rosette

---

<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:** [June 1, 2010, 8:19pm UTC](https://discuss.elastic.co/t/newbie-question-about--terms-and-filters/2986/2 "2010-06-01T20:19:18Z")

</div>

What you are talking about are facets (dynamic) ones. There is support for  
query based facets that return a total count, but not automatically return a  
count per term value based on a search request. This is a planned feature.

On Tue, Jun 1, 2010 at 4:18 PM, Dominique Rose-Rosette \<  
[droserosette@gmail.com](mailto:droserosette@gmail.com)\> wrote:

> Hi,
> 
> I'm having a hard time figuring how I could retrieve the terms  
> belonging to a subset of the indexed documents.
> 
> For instance, given a call as such:
> 
> curl -XGET "[http://localhost:9200/\_terms?fields=posts.tags](http://localhost:9200/_terms?fields=posts.tags)"
> 
> How can I narrow it down to terms corresponding to posts with a  
> "status" of "published"? I tried providing a Filtered Query in the  
> request body, to no avail. I am doing it wrong (most probably) or is  
> it just not possible (yet)?
> 
> Dominique Rose-Rosette

---

<div class="post-metadata">

**Author:** ![Dominique\_Rose\_Roset](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@Dominique\_Rose\_Roset](https://discuss.elastic.co/u/Dominique_Rose_Roset)\
**Post date:** [June 1, 2010, 9:45pm UTC](https://discuss.elastic.co/t/newbie-question-about--terms-and-filters/2986/3 "2010-06-01T21:45:34Z")

</div>

Le 01/06/2010 22:19, Shay Banon a Ã©crit :

> What you are talking about are facets (dynamic) ones. There is support  
> for query based facets that return a total count, but not  
> automatically return a count per term value based on a search request.  
> This is a planned feature.
> 
> On Tue, Jun 1, 2010 at 4:18 PM, Dominique Rose-Rosette  
> \<[droserosette@gmail.com](mailto:droserosette@gmail.com) [mailto:droserosette@gmail.com](mailto:droserosette@gmail.com)\> wrote:
> 
> ```
> Hi,
> 
> I'm having a hard time figuring how I could retrieve the terms
> belonging to a subset of the indexed documents.
> 
> For instance, given a call as such:
> 
> curl -XGET "http://localhost:9200/_terms?fields=posts.tags"
> 
> How can I narrow it down to terms corresponding to posts with a
> "status" of "published"? I tried providing a Filtered Query in the
> request body, to no avail. I am doing it wrong (most probably) or is
> it just not possible (yet)?
> 
> Dominique Rose-Rosette
> 
> ```

OK. 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 6, 2017, 4:23am UTC](https://discuss.elastic.co/t/newbie-question-about--terms-and-filters/2986/4 "2017-07-06T04:23:39Z")

</div>


