No query registered for [facets]]


(Lucas Rutledge) #1

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.
For more options, visit https://groups.google.com/groups/opt_out.


(Honza Král) #2

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.comwrote:

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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Lucas Rutledge) #3

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<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 <javascript:>.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4