# Nested facet or facet\_filter?

**URL:** <https://discuss.elastic.co/t/nested-facet-or-facet-filter/14787>\
**Category:** Elasticsearch\
**Created:** [December 10, 2013, 6:43am UTC](https://discuss.elastic.co/t/nested-facet-or-facet-filter/14787 "2013-12-10T06:43:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zh3w4ng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zh3w4ng/32/1928_2.png) [@zh3w4ng](https://discuss.elastic.co/u/zh3w4ng)\
**Post date:** [December 10, 2013, 6:43am UTC](https://discuss.elastic.co/t/nested-facet-or-facet-filter/14787/1 "2013-12-10T06:43:42Z")

</div>

Hi everyone,

I'm new to elasticsearch and hope any expert can help me with this problem.  
I want to remove the redundancy of repeated requests from the same session  
and obtain the room's unique view counts from every country.

Here is the mapping. sid means session id.

mappings:{  
fluentd:{  
properties:{  
sid:{type:"string"},  
params:{  
properties:{  
room\_id:{type:"string"}  
}  
},  
country:{type:"string"},  
controller:{type:"string"},  
action:{type:"string"}  
}  
}  
}

I have the basic code for counting without ruling out multiple requests  
from the same session. I don't know what I should to to remove the  
redundancy.

curl -XGET 'http://log\_server:9200/one\_day\_log/\_search' -d '{  
"query":{"bool":{"must":[  
{"match":{"controller":"rooms"}},  
{"match":{"action":"show"}},  
{"match":{"params.id":"138999"}}  
]}},  
"facets":{  
"countries":{"terms":{"field":"country"}}  
}  
}'

Thanks,  
Zhe

--  
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/fe8fc39a-5075-4915-9648-eeefccc8aa77%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fe8fc39a-5075-4915-9648-eeefccc8aa77%40googlegroups.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:02am UTC](https://discuss.elastic.co/t/nested-facet-or-facet-filter/14787/2 "2017-07-06T02:02:20Z")

</div>

Closed on July 6, 2017, 2:02am UTC


