# No query registered for \[facets\]\]

**URL:** <https://discuss.elastic.co/t/no-query-registered-for-facets/14516>\
**Category:** Elasticsearch\
**Created:** [November 21, 2013, 2:38pm UTC](https://discuss.elastic.co/t/no-query-registered-for-facets/14516 "2013-11-21T14:38:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Rutledge](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@Lucas\_Rutledge](https://discuss.elastic.co/u/Lucas_Rutledge)\
**Post date:** [November 21, 2013, 2:38pm UTC](https://discuss.elastic.co/t/no-query-registered-for-facets/14516/1 "2013-11-21T14:38:59Z")

</div>

I'm trying to use the elasticsearch python client to send a query however I  
keep getting No query registered for [facets]] back each time. Can anyone  
tell me what I am doing wrong here?

query = {  
"facets" : {  
"pie" : {  
"terms" : {  
"field" : "@device\_type",  
"size" : 100

```
            },
            "facet_filter" : { 
                "fquery" : { 
                    "query" : {
                        "filtered" : {
                            "query" : {
                                "query_string" : {
                                    "query" : "xmlrpc.fcgi"
                                }
                                #"term" : {"%s" % field : "%s" % 

```

param},  
},  
"filter" : {  
"range" : {  
"@timestamp" : {  
"gte": "%s" % ft,  
"lte": "%s" % tt  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}

res = es.count(index='\_all', body=query)

--  
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:** ![Honza\_Kral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/honza_kral/32/876_2.png) [@Honza\_Kral](https://discuss.elastic.co/u/Honza_Kral)\
**Post date:** [November 21, 2013, 3:10pm UTC](https://discuss.elastic.co/t/no-query-registered-for-facets/14516/2 "2013-11-21T15:10:20Z")

</div>

Hi Lucas,

the body for count() api is different then for search() - it should contain  
just the 'query' key from the body that would be sent through search(). Use

es.search(body={'facets': {'tags': {'terms': {'field': 'tags'}}}},  
search\_type='count')

instead.

Thanks!

On Thu, Nov 21, 2013 at 3:38 PM, Lucas Rutledge [lrutledge1@gmail.com](mailto:lrutledge1@gmail.com)wrote:

> I'm trying to use the elasticsearch python client to send a query however  
> I keep getting No query registered for [facets]] back each time. Can  
> anyone tell me what I am doing wrong here?
> 
> query = {  
> "facets" : {  
> "pie" : {  
> "terms" : {  
> "field" : "@device\_type",  
> "size" : 100
> 
> ```
> },
> "facet_filter" : {
> "fquery" : {
> "query" : {
> "filtered" : {
> "query" : {
> "query_string" : {
> "query" : "xmlrpc.fcgi"
> }
> #"term" : {"%s" % field : "%s" %
> 
> ```
> 
> param},  
> },  
> "filter" : {  
> "range" : {  
> "@timestamp" : {  
> "gte": "%s" % ft,  
> "lte": "%s" % tt  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }
> 
> res = es.count(index='\_all', body=query)
> 
> --  
> 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:** ![Lucas\_Rutledge](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@Lucas\_Rutledge](https://discuss.elastic.co/u/Lucas_Rutledge)\
**Post date:** [November 21, 2013, 3:21pm UTC](https://discuss.elastic.co/t/no-query-registered-for-facets/14516/3 "2013-11-21T15:21:42Z")

</div>

Wow can't believe I missed that. Thanks, much appreciated.

On Thursday, November 21, 2013 9:10:20 AM UTC-6, Honza Král wrote:

> Hi Lucas,
> 
> the body for count() api is different then for search() - it should  
> contain just the 'query' key from the body that would be sent through  
> search(). Use
> 
> es.search(body={'facets': {'tags': {'terms': {'field': 'tags'}}}},  
> search\_type='count')
> 
> instead.
> 
> Thanks!
> 
> On Thu, Nov 21, 2013 at 3:38 PM, Lucas Rutledge \<[lrutl...@gmail.com](mailto:lrutl...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I'm trying to use the elasticsearch python client to send a query however  
> > I keep getting No query registered for [facets]] back each time. Can  
> > anyone tell me what I am doing wrong here?
> > 
> > query = {  
> > "facets" : {  
> > "pie" : {  
> > "terms" : {  
> > "field" : "@device\_type",  
> > "size" : 100
> > 
> > ```
> > },
> > "facet_filter" : { 
> > "fquery" : { 
> > "query" : {
> > "filtered" : {
> > "query" : {
> > "query_string" : {
> > "query" : "xmlrpc.fcgi"
> > }
> > #"term" : {"%s" % field : "%s" % 
> > 
> > ```
> > 
> > param},  
> > },  
> > "filter" : {  
> > "range" : {  
> > "@timestamp" : {  
> > "gte": "%s" % ft,  
> > "lte": "%s" % tt  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > res = es.count(index='\_all', body=query)
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > 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:** ![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:05am UTC](https://discuss.elastic.co/t/no-query-registered-for-facets/14516/4 "2017-07-06T02:05:39Z")

</div>


