Terms facet to include item where term is missing


(nmosafi) #1

Say I have two documents like so:

{ "field1": "hello", "field2": "world" }
{ "field1": "moo" }

And I run a terms facet on field2.

It would give me count 1 for "world" but I would also want a count of
1 for null. Is this possible to achieve this somehow?

(Note: all fields are set to non_analysed in the dynamic_mapping.json)

Thanks
Neil


(Shay Banon) #2

Sure, quite simple to implement, can you open a feature request?
On Tuesday, January 18, 2011 at 1:51 AM, Neil Mosafi wrote:

Say I have two documents like so:

{ "field1": "hello", "field2": "world" }
{ "field1": "moo" }

And I run a terms facet on field2.

It would give me count 1 for "world" but I would also want a count of
1 for null. Is this possible to achieve this somehow?

(Note: all fields are set to non_analysed in the dynamic_mapping.json)

Thanks
Neil


(nmosafi) #3

Yep, here is it

Cheers

On Jan 18, 12:21 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Sure, quite simple to implement, can you open a feature request?

On Tuesday, January 18, 2011 at 1:51 AM, Neil Mosafi wrote:

Say I have two documents like so:

{ "field1": "hello", "field2": "world" }
{ "field1": "moo" }

And I run a terms facet on field2.

It would give me count 1 for "world" but I would also want a count of
1 for null. Is this possible to achieve this somehow?

(Note: all fields are set to non_analysed in the dynamic_mapping.json)

Thanks
Neil


(ppearcy) #4

Looks like this was just added, sweet :slight_smile:

Curious, will this functionality treat all the following the same for
field2?
{ "field1": "moo" }
{ "field1": "moo", "field2": null }
{ "field1": "moo", "field2": "" }

Thanks!

On Jan 18, 11:15 am, Neil Mosafi nmos...@gmail.com wrote:

Yep, here is it

https://github.com/elasticsearch/elasticsearch/issues/issue/632

Cheers

On Jan 18, 12:21 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Sure, quite simple to implement, can you open a feature request?

On Tuesday, January 18, 2011 at 1:51 AM, Neil Mosafi wrote:

Say I have two documents like so:

{ "field1": "hello", "field2": "world" }
{ "field1": "moo" }

And I run a terms facet on field2.

It would give me count 1 for "world" but I would also want a count of
1 for null. Is this possible to achieve this somehow?

(Note: all fields are set to non_analysed in the dynamic_mapping.json)

Thanks
Neil


(Shay Banon) #5

Yea, though null values are generally better to use than empty strings.
On Wednesday, January 19, 2011 at 4:26 AM, Paul wrote:

Looks like this was just added, sweet :slight_smile:

Curious, will this functionality treat all the following the same for
field2?
{ "field1": "moo" }
{ "field1": "moo", "field2": null }
{ "field1": "moo", "field2": "" }

Thanks!

On Jan 18, 11:15 am, Neil Mosafi nmos...@gmail.com wrote:

Yep, here is it

https://github.com/elasticsearch/elasticsearch/issues/issue/632

Cheers

On Jan 18, 12:21 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Sure, quite simple to implement, can you open a feature request?

On Tuesday, January 18, 2011 at 1:51 AM, Neil Mosafi wrote:

Say I have two documents like so:

{ "field1": "hello", "field2": "world" }
{ "field1": "moo" }

And I run a terms facet on field2.

It would give me count 1 for "world" but I would also want a count of
1 for null. Is this possible to achieve this somehow?

(Note: all fields are set to non_analysed in the dynamic_mapping.json)

Thanks
Neil


(system) #6