# Facet on two fields

**URL:** <https://discuss.elastic.co/t/facet-on-two-fields/12831>\
**Category:** Elasticsearch\
**Created:** [July 17, 2013, 4:51pm UTC](https://discuss.elastic.co/t/facet-on-two-fields/12831 "2013-07-17T16:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolas\_maillard](https://avatars.discourse-cdn.com/v4/letter/n/8797f3/32.png) [@nicolas\_maillard](https://discuss.elastic.co/u/nicolas_maillard)\
**Post date:** [July 17, 2013, 4:51pm UTC](https://discuss.elastic.co/t/facet-on-two-fields/12831/1 "2013-07-17T16:51:33Z")

</div>

Hi everyone

I'm playing around with elasticsearch and all is nice and fast.  
I'm not used to all the factes yet and there is a query I can't figure out  
how to do .  
Say I have users and these users have cars and this list can move from day  
to day as they sell or buy other cars.  
I'm trying to count all distinct cars for every user or even just one user  
on a daily basis or just in general.

Another way of saying it would be I have an entry with user\_id , and car  
name for every time the user byes a car, I want to count for earch user how  
different cars they have bought.

Is there a facet for this kind query, I was hoping on term stats but since  
I have car names and not values id does not work

Thanks for your help

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:25am UTC](https://discuss.elastic.co/t/facet-on-two-fields/12831/2 "2017-07-06T02:25:54Z")

</div>


