Sorting of numeric 'null' fields

When sorting results by a numeric (integer) field I noticed that
documents with missing values are sorted as if the value would be
numeric 0. Is this intended behavior? I know that I can provide a
default value to be indexed as part of the mapping definition.
However, without such a mapping the default behavior is not to add the
field at all (this is what the doc says and what I want). What I need
from a business prospective is that documents with 'null' values for
the sort field are always at the end of the sorted result (independent
of sort order). I kind of remember this to be referred to as
'sortMissingLast' in the Lucene / SOLR community.

Yes, thats the current behavior. This can be added quite easily, care to open an issue for htis?
On Friday, March 11, 2011 at 4:43 PM, Jan Fiedler wrote:

When sorting results by a numeric (integer) field I noticed that
documents with missing values are sorted as if the value would be
numeric 0. Is this intended behavior? I know that I can provide a
default value to be indexed as part of the mapping definition.
However, without such a mapping the default behavior is not to add the
field at all (this is what the doc says and what I want). What I need
from a business prospective is that documents with 'null' values for
the sort field are always at the end of the sorted result (independent
of sort order). I kind of remember this to be referred to as
'sortMissingLast' in the Lucene / SOLR community.

Filed enhancement request: Sort: Support "missing" specific handling, include _last, _first, and custom value (for numeric values) · Issue #772 · elastic/elasticsearch · GitHub
Looking forward to it ... :wink:

On Mar 12, 9:05 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Yes, thats the current behavior. This can be added quite easily, care to open an issue for htis?

On Friday, March 11, 2011 at 4:43 PM, Jan Fiedler wrote:

When sorting results by a numeric (integer) field I noticed that
documents with missing values are sorted as if the value would be
numeric 0. Is this intended behavior? I know that I can provide a
default value to be indexed as part of the mapping definition.
However, without such a mapping the default behavior is not to add the
field at all (this is what the doc says and what I want). What I need
from a business prospective is that documents with 'null' values for
the sort field are always at the end of the sorted result (independent
of sort order). I kind of remember this to be referred to as
'sortMissingLast' in the Lucene / SOLR community.