Faceting on non-existent field

Hi all,

When doing a faceted filter/query where the facet term doesn't exist in any
document, is it possible for elasticsearch to return an empty facet result,
rather than throw an exception?

If this isn't possible, would it be reasonable to add an option to the API
to turn this functionality on?

Thanks
A

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

Hey,

can you sent a gist of what you do in order to trigger an exception.
Usually an empty result like this is returned

curl -X PUT localhost:9200/foo
{"ok":true,"acknowledged":true}

curl -X POST 'localhost:9200/foo/_search?pretty' -d '{ "facets" : { "foo"
: { "terms" : { "field" : "bar" } } } }'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
},
"facets" : {
"foo" : {
"_type" : "terms",
"missing" : 0,
"total" : 0,
"other" : 0,
"terms" :
}
}
}

Maybe you had a slight error in your query somewhere?

--Alex

On Wed, Jun 19, 2013 at 9:49 AM, Allan Johns nerdvegas@gmail.com wrote:

Hi all,

When doing a faceted filter/query where the facet term doesn't exist in
any document, is it possible for elasticsearch to return an empty facet
result, rather than throw an exception?

If this isn't possible, would it be reasonable to add an option to the API
to turn this functionality on?

Thanks
A

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

Hey Alexander,

Running your example query I get:

FacetPhaseExecutionException[Facet [foo]: failed to find mapping for
[bar]];

In a duplicate thread someone has said this is fixed in 0.90.1 (I'm on
0.90.0), so I'm goign to try that.

Thanks for your help
A

On Mon, Jun 24, 2013 at 11:45 PM, Alexander Reelsen alr@spinscale.dewrote:

Hey,

can you sent a gist of what you do in order to trigger an exception.
Usually an empty result like this is returned

curl -X PUT localhost:9200/foo
{"ok":true,"acknowledged":true}

curl -X POST 'localhost:9200/foo/_search?pretty' -d '{ "facets" : { "foo"
: { "terms" : { "field" : "bar" } } } }'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
},
"facets" : {
"foo" : {
"_type" : "terms",
"missing" : 0,
"total" : 0,
"other" : 0,
"terms" :
}
}
}

Maybe you had a slight error in your query somewhere?

--Alex

On Wed, Jun 19, 2013 at 9:49 AM, Allan Johns nerdvegas@gmail.com wrote:

Hi all,

When doing a faceted filter/query where the facet term doesn't exist in
any document, is it possible for elasticsearch to return an empty facet
result, rather than throw an exception?

If this isn't possible, would it be reasonable to add an option to the
API to turn this functionality on?

Thanks
A

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

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