Terms facet to include item where term is missing

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

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

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

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

Terms Facet: Add option include counts where term is missing · Issue #632 · elastic/elasticsearch · GitHub

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

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

Terms Facet: Add option include counts where term is missing · Issue #632 · elastic/elasticsearch · GitHub

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