Problem with facet query


(Rafał Kuć) #1

Hi,

I have a problem with facet query. The following query works without a
problem:
{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"types":{"terms":{"field":"type"}},"count":{"query":{"match_all":[]}}}}

However, when I change the order of keys in the "facets" part of the query
ElasticSearch throws an exception. For example:
{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"count":{"query":{"match_all":[]}},"types":{"terms":{"field":"type"}}}}

Am I missing something or do I have an error in the query ?

Thanks
Rafał
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch


(Shay Banon) #2

Maybe its the fact that your match_all is not constructed correctly? It
should be match_all: {}, not match_all : []. If you still get it, can you
create a simple curl repro?

On Thu, May 10, 2012 at 10:26 AM, Rafał Kuć r.kuc@solr.pl wrote:

Hi,

I have a problem with facet query. The following query works without a
problem:

{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"types":{"terms":{"field":"type"}},"count":{"query":{"match_all":[]}}}}

However, when I change the order of keys in the "facets" part of the query
ElasticSearch throws an exception. For example:

{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"count":{"query":{"match_all":[]}},"types":{"terms":{"field":"type"}}}}

Am I missing something or do I have an error in the query ?

Thanks
Rafał
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch


(Rafał Kuć) #3

Hello!

Thanks Shay, it worked. Don't know why I haven't spotted that :slight_smile:

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

Maybe its the fact that your match_all is not constructed correctly? It should be match_all: {}, not match_all : []. If you still get it, can you create a simple curl repro?

On Thu, May 10, 2012 at 10:26 AM, Rafał Kuć <r.kuc@solr.pl> wrote:

Hi,

I have a problem with facet query. The following query works without a problem:

{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"types":{"terms":{"field":"type"}},"count":{"query":{"match_all":[]}}}}

However, when I change the order of keys in the "facets" part of the query ElasticSearch throws an exception. For example:

{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"count":{"query":{"match_all":[]}},"types":{"terms":{"field":"type"}}}}

Am I missing something or do I have an error in the query ?

Thanks

Rafał

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch


(Shay Banon) #4

Yea, we should properly fail in this case..., open an issue?

On Mon, May 14, 2012 at 1:20 PM, Rafał Kuć r.kuc@solr.pl wrote:

Hello!

Thanks Shay, it worked. Don't know why I haven't spotted that :slight_smile:

*--
Regards,
Rafał Kuć
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
ElasticSearch

Maybe its the fact that your match_all is not constructed correctly? It
should be match_all: {}, not match_all : []. If you still get it, can you
create a simple curl repro?

On Thu, May 10, 2012 at 10:26 AM, Rafał Kuć r.kuc@solr.pl wrote:
Hi,

I have a problem with facet query. The following query works without a
problem:

{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"types":{"terms":{"field":"type"}},"count":{"query":{"match_all":[]}}}}

However, when I change the order of keys in the "facets" part of the query
ElasticSearch throws an exception. For example:

{"sort":[{"date":{"order":"desc"}},"_score"],"from":0,"fields":["_source"],"query":{"query_string":{"query":"test"}},"size":10,"facets":{"tags":{"terms":{"field":"tags"}},"count":{"query":{"match_all":[]}},"types":{"terms":{"field":"type"}}}}

Am I missing something or do I have an error in the query ?

Thanks
Rafał
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch


(system) #5