# Question about Facet

**URL:** <https://discuss.elastic.co/t/question-about-facet/11412>\
**Category:** Elasticsearch\
**Created:** [April 2, 2013, 1:08pm UTC](https://discuss.elastic.co/t/question-about-facet/11412 "2013-04-02T13:08:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yahia](https://avatars.discourse-cdn.com/v4/letter/y/d9b06d/32.png) [@yahia](https://discuss.elastic.co/u/yahia)\
**Post date:** [April 2, 2013, 1:08pm UTC](https://discuss.elastic.co/t/question-about-facet/11412/1 "2013-04-02T13:08:21Z")

</div>

I have documents which are indexed from fs river  
I want to create a facet that filter document folowing their type (. pdf.  
doc. txt etc.) ....  
what is the best ways to do ?

I create different types under the same index for exemple: documents that  
have "pdf" type will be indexed under "myDoc" index and have "pdf" type ,  
document with type txt will be indexed under the same index but have a  
"txt" type....

after I create my facet on the type field

is there another way to do it?

--  
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:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 2, 2013, 1:22pm UTC](https://discuss.elastic.co/t/question-about-facet/11412/2 "2013-04-02T13:22:00Z")

</div>

Hey

if you really mean the type of the document (not some metadata inside of  
the document), how about this

curl -X POST 'localhost:9200/test/\_search?pretty' -d '{ "query":{  
"match\_all" : {} }, "facets" : { "types" : { "terms" : { "field" :"\_type"}  
} } }'

In case I didnt get your question completely, just ask harder 🙂

On Tue, Apr 2, 2013 at 3:08 PM, Ammar Yahia [yahia.ammar.info@gmail.com](mailto:yahia.ammar.info@gmail.com)wrote:

> I have documents which are indexed from fs river  
> I want to create a facet that filter document folowing their type (. pdf.  
> doc. txt etc.) ....  
> what is the best ways to do ?
> 
> I create different types under the same index for exemple: documents that  
> have "pdf" type will be indexed under "myDoc" index and have "pdf" type ,  
> document with type txt will be indexed under the same index but have a  
> "txt" type....
> 
> after I create my facet on the type field
> 
> is there another way to do it?
> 
> --  
> 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).

--  
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:** ![yahia](https://avatars.discourse-cdn.com/v4/letter/y/d9b06d/32.png) [@yahia](https://discuss.elastic.co/u/yahia)\
**Post date:** [April 2, 2013, 2:08pm UTC](https://discuss.elastic.co/t/question-about-facet/11412/3 "2013-04-02T14:08:16Z")

</div>

is elasticsearch can detect the type of document at indexing time and  
assigns it to a field in the meta data of the document ??  
ie when indexing a document type pdf, it automatically detects that this is  
a PDF document, and updates a field in the meta data document, this field  
indicate a type of indexed docuement

--  
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:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 2, 2013, 3:30pm UTC](https://discuss.elastic.co/t/question-about-facet/11412/4 "2013-04-02T15:30:01Z")

</div>

No. Mapper attachment does not autodetect types.  
See [save all tika metadata · Issue #1 · elastic/elasticsearch-mapper-attachments · GitHub](https://github.com/elasticsearch/elasticsearch-mapper-attachments/issues/1)

I think we can solve this but it's not here yet.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 2 avr. 2013 à 16:08, Ammar Yahia [yahia.ammar.info@gmail.com](mailto:yahia.ammar.info@gmail.com) a écrit :

> is elasticsearch can detect the type of document at indexing time and assigns it to a field in the meta data of the document ??  
> ie when indexing a document type pdf, it automatically detects that this is a PDF document, and updates a field in the meta data document, this field indicate a type of indexed docuement
> 
> --  
> 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).

--  
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:** ![yahia](https://avatars.discourse-cdn.com/v4/letter/y/d9b06d/32.png) [@yahia](https://discuss.elastic.co/u/yahia)\
**Post date:** [April 3, 2013, 7:10am UTC](https://discuss.elastic.co/t/question-about-facet/11412/5 "2013-04-03T07:10:58Z")

</div>

ok thx a lot

--Yahia

--  
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:43am UTC](https://discuss.elastic.co/t/question-about-facet/11412/6 "2017-07-06T02:43:07Z")

</div>


