# Facet\_filter simple example not working

**URL:** <https://discuss.elastic.co/t/facet-filter-simple-example-not-working/11262>\
**Category:** Elasticsearch\
**Created:** [March 22, 2013, 1:54pm UTC](https://discuss.elastic.co/t/facet-filter-simple-example-not-working/11262 "2013-03-22T13:54:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![waldemar](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@waldemar](https://discuss.elastic.co/u/waldemar)\
**Post date:** [March 22, 2013, 1:54pm UTC](https://discuss.elastic.co/t/facet-filter-simple-example-not-working/11262/1 "2013-03-22T13:54:51Z")

</div>

Hi All,

I'm trying to execute statistical facet with filter. So I'm using  
"facet\_filter" without success.  
Could you please help me with correct query?  
Or maybe there is something else wrong?

My ElasticSearch version is 0.20.2.  
My document structure/mapping is:

{"wch1":{"properties":{"HouseCode":{"type":"string"},  
"numbers":{"type":"string"},  
"period":{"type":"string","index":"not\_analyzed",  
"omit\_norms":true,"index\_options":"docs"}}}}

Example document:

{HouseCode:"AB-0013-01", period:["2013-05-23|2013-05-29",  
"2013-03-23|2013-06-29", "2013-06-23|2013-06-29"], numbers:",4,71,5,333,"}

My query/facet is:

curl -XGET [http://localhost:9200/test\_wch/wch1/\_search](http://localhost:9200/test_wch/wch1/_search) -d '{"facets" : {  
"fname" : {"statistical" : {"field":"numbers"} }, "facet\_filter" : {"term"  
: { "HouseCode" : "ab"}} } } }'

And I get error:

... Parse Failure [No facet type found for [term]]]; }]","status":500}

Please help. Thanks in advance.

Best Regards,  
Waldek

--  
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:** ![waldemar](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@waldemar](https://discuss.elastic.co/u/waldemar)\
**Post date:** [March 22, 2013, 1:58pm UTC](https://discuss.elastic.co/t/facet-filter-simple-example-not-working/11262/2 "2013-03-22T13:58:33Z")

</div>

PS. In this example numbers are as string, but even when they are set as an  
array of numbers query also not working, and I've got the same error.

--  
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:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 25, 2013, 6:48pm UTC](https://discuss.elastic.co/t/facet-filter-simple-example-not-working/11262/3 "2013-03-25T18:48:33Z")

</div>

```
Subject: Re: facet_filter simple example not working

```

Date: Mon, 25 Mar 2013 19:43:20 +0100

> My query/facet is:
> 
> curl -XGET [http://localhost:9200/test\_wch/wch1/\_search](http://localhost:9200/test_wch/wch1/_search) -d '{"facets" :  
> { "fname" : {"statistical" : {"field":"numbers"} }, "facet\_filter" :  
> {"term" : { "HouseCode" : "ab"}} } } }'
> 
> And I get error:
> 
> ... Parse Failure [No facet type found for [term]]]; }]","status":500}

If you pretty-print your JSON, you will see that your facet\_filter is at  
the wrong level. It should be like this:

{  
"facets" : {  
"fname" : {  
"statistical" : {  
"field":"numbers"  
}  
"facet\_filter" : {  
"term" : {  
"HouseCode" : "ab"  
}  
}  
}  
}  
}  
}

clint

--  
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:44am UTC](https://discuss.elastic.co/t/facet-filter-simple-example-not-working/11262/4 "2017-07-06T02:44:39Z")

</div>


