Best way of faceting on boolean field

Helllo,

When faceting on boolean field by default ES uses T and F for values. I
would prefer Yes, No, N/A (when it is blank) but I do not want to pollute
my source json substituting boolean for Yes, No, N/A string and then having
to deal with the text when consuming source data. (there are quite a few of
boolean fields I need to support) Of course I can have my UI translate T
and F to and from Yes, No, N/A but it woul dbe nice if I did not have to do
it plus I want to be able to facet/filter on N/A for missing true/false
values which plain faceting on boolean won't do (well it will give me
missing but filtering on it will require filtering on not(true or false)).
I was wondering if there is an elegant solution for it with multifield
mapping. I know it could solve n/a issue since mapping allows to specify
default value for empty json properties but I will need to change mapping
from boolean to string and I do not know how to translate boolean to Yes,
No, N/A. Use scripting?

Thank you,
Alex

--

Hi!

For a patch and workaround please see https://github.com/elasticsearch/elasticsearch/issues/2462

Cheers,
-k

On Jan 26, 2013, at 2:25 AM, AlexR roytmana@gmail.com wrote:

Helllo,

When faceting on boolean field by default ES uses T and F for values. I would prefer Yes, No, N/A (when it is blank) but I do not want to pollute my source json substituting boolean for Yes, No, N/A string and then having to deal with the text when consuming source data. (there are quite a few of boolean fields I need to support) Of course I can have my UI translate T and F to and from Yes, No, N/A but it woul dbe nice if I did not have to do it plus I want to be able to facet/filter on N/A for missing true/false values which plain faceting on boolean won't do (well it will give me missing but filtering on it will require filtering on not(true or false)). I was wondering if there is an elegant solution for it with multifield mapping. I know it could solve n/a issue since mapping allows to specify default value for empty json properties but I will need to change mapping from boolean to string and I do not know how to translate boolean to Yes, No, N/A. Use scripting?

Thank you,
Alex

--

Thanks Kay,

As far as needing to facet on true/false/null what's the typical approach?
use facet._missing for count and "not include true and false" filter?
Is there a better technique of filtering on missing/null values in case of
boolean in in general case of string tokens?

Thank you,
Alex

On Saturday, January 26, 2013 5:06:42 AM UTC-5, Kay Röpke wrote:

Hi!

For a patch and workaround please see
https://github.com/elasticsearch/elasticsearch/issues/2462

Cheers,
-k

On Jan 26, 2013, at 2:25 AM, AlexR <royt...@gmail.com <javascript:>>
wrote:

Helllo,

When faceting on boolean field by default ES uses T and F for values. I
would prefer Yes, No, N/A (when it is blank) but I do not want to pollute
my source json substituting boolean for Yes, No, N/A string and then having
to deal with the text when consuming source data. (there are quite a few of
boolean fields I need to support) Of course I can have my UI translate T
and F to and from Yes, No, N/A but it woul dbe nice if I did not have to do
it plus I want to be able to facet/filter on N/A for missing true/false
values which plain faceting on boolean won't do (well it will give me
missing but filtering on it will require filtering on not(true or false)).
I was wondering if there is an elegant solution for it with multifield
mapping. I know it could solve n/a issue since mapping allows to specify
default value for empty json properties but I will need to change mapping
from boolean to string and I do not know how to translate boolean to Yes,
No, N/A. Use scripting?

Thank you,
Alex

--

--

Well found
it http://www.elasticsearch.org/guide/reference/query-dsl/missing-filter.html

On Saturday, January 26, 2013 11:20:08 AM UTC-5, AlexR wrote:

Thanks Kay,

As far as needing to facet on true/false/null what's the typical approach?
use facet._missing for count and "not include true and false" filter?
Is there a better technique of filtering on missing/null values in case of
boolean in in general case of string tokens?

Thank you,
Alex

On Saturday, January 26, 2013 5:06:42 AM UTC-5, Kay Röpke wrote:

Hi!

For a patch and workaround please see
https://github.com/elasticsearch/elasticsearch/issues/2462

Cheers,
-k

On Jan 26, 2013, at 2:25 AM, AlexR royt...@gmail.com wrote:

Helllo,

When faceting on boolean field by default ES uses T and F for values. I
would prefer Yes, No, N/A (when it is blank) but I do not want to pollute
my source json substituting boolean for Yes, No, N/A string and then having
to deal with the text when consuming source data. (there are quite a few of
boolean fields I need to support) Of course I can have my UI translate T
and F to and from Yes, No, N/A but it woul dbe nice if I did not have to do
it plus I want to be able to facet/filter on N/A for missing true/false
values which plain faceting on boolean won't do (well it will give me
missing but filtering on it will require filtering on not(true or false)).
I was wondering if there is an elegant solution for it with multifield
mapping. I know it could solve n/a issue since mapping allows to specify
default value for empty json properties but I will need to change mapping
from boolean to string and I do not know how to translate boolean to Yes,
No, N/A. Use scripting?

Thank you,
Alex

--

--