# Nullpointer on sort, version 0.90.3

**URL:** <https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285>\
**Category:** Elasticsearch\
**Created:** [August 21, 2013, 1:33pm UTC](https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285 "2013-08-21T13:33:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Runar\_Myklebust](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Runar\_Myklebust](https://discuss.elastic.co/u/Runar_Myklebust)\
**Post date:** [August 21, 2013, 1:33pm UTC](https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285/1 "2013-08-21T13:33:48Z")

</div>

Im doing a test-upgrade on our product, embedding ES version 0.20.6 to  
0.90.3

Suddenly, a lot of queries fails with NPE. Ive isolated the problem to  
happen on sorting on some (most) values:

Here is query i test on:

{  
"size": 0,  
"query": {  
"match\_all": {}  
},  
"sort" : {  
"position\_section\_1954.orderby" : {  
"ignore\_unmapped" : true  
}  
}  
}

which fails with exception:

{  
"error": "SearchPhaseExecutionException[Failed to execute phase  
[query], all shards failed; shardFailures  
{[ViFbnvtyQpG3oc04Mke8wA][cms][0]: QueryPhaseExecutionException[[cms][0]:  
query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
Query Failed [Failed to execute main query]]; nested: NullPointerException;  
}{[ViFbnvtyQpG3oc04Mke8wA][cms][2]: QueryPhaseExecutionException[[cms][2]:  
query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
Query Failed [Failed to execute main query]]; nested: NullPointerException;  
}{[ViFbnvtyQpG3oc04Mke8wA][cms][1]: QueryPhaseExecutionException[[cms][1]:  
query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
Query Failed [Failed to execute main query]]; nested: NullPointerException;  
}{[ViFbnvtyQpG3oc04Mke8wA][cms][3]: QueryPhaseExecutionException[[cms][3]:  
query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@19fb31ff\>]:  
Query Failed [Failed to execute main query]]; nested: NullPointerException;  
}]",  
"status": 500  
}

The mapping for this field is:

position\_section\_1845.orderby": {  
"type": "string",  
"index": "not\_analyzed",  
"omit\_norms": true,  
"index\_options": "docs"  
}

I see when debug that this happens because this line: Object ordsStorage =  
docToOrd.ordinals().getBackingStorage() in BytesRefOrdValComparator uses  
the MultiOrdinals-implementation where docToOrd.ordinals() always is null?  
Some other field works all right when soring on them (with same mapping)  
but most now fails with same exception.

Is this i a bug or do I have to seek the answer somewhere in our  
implementation of e.g storing data? We had no trouble with this using 0.20.6

## greetings

Runar Myklebust

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Runar\_Myklebust](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Runar\_Myklebust](https://discuss.elastic.co/u/Runar_Myklebust)\
**Post date:** [August 21, 2013, 1:40pm UTC](https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285/2 "2013-08-21T13:40:46Z")

</div>

Sorry, messed up some of the fieldnames here since i copy/pasted from  
different tests, but the field name "position\_section\_1954.orderby" is  
present in the exception, and the mapping is also for  
position\_section\_1954.orderby.

On Wed, Aug 21, 2013 at 3:33 PM, Runar Myklebust [runar.a.m@gmail.com](mailto:runar.a.m@gmail.com)wrote:

> Im doing a test-upgrade on our product, embedding ES version 0.20.6 to  
> 0.90.3
> 
> Suddenly, a lot of queries fails with NPE. Ive isolated the problem to  
> happen on sorting on some (most) values:
> 
> Here is query i test on:
> 
> {  
> "size": 0,  
> "query": {  
> "match\_all": {}  
> },  
> "sort" : {  
> "position\_section\_1954.orderby" : {  
> "ignore\_unmapped" : true  
> }  
> }  
> }
> 
> which fails with exception:
> 
> {  
> "error": "SearchPhaseExecutionException[Failed to execute phase  
> [query], all shards failed; shardFailures  
> {[ViFbnvtyQpG3oc04Mke8wA][cms][0]: QueryPhaseExecutionException[[cms][0]:  
> query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
> Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> }{[ViFbnvtyQpG3oc04Mke8wA][cms][2]: QueryPhaseExecutionException[[cms][2]:  
> query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
> Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> }{[ViFbnvtyQpG3oc04Mke8wA][cms][1]: QueryPhaseExecutionException[[cms][1]:  
> query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
> Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> }{[ViFbnvtyQpG3oc04Mke8wA][cms][3]: QueryPhaseExecutionException[[cms][3]:  
> query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@19fb31ff\>]:  
> Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> }]",  
> "status": 500  
> }
> 
> The mapping for this field is:
> 
> position\_section\_1845.orderby": {  
> "type": "string",  
> "index": "not\_analyzed",  
> "omit\_norms": true,  
> "index\_options": "docs"  
> }
> 
> I see when debug that this happens because this line: Object ordsStorage =  
> docToOrd.ordinals().getBackingStorage() in BytesRefOrdValComparator uses  
> the MultiOrdinals-implementation where docToOrd.ordinals() always is null?  
> Some other field works all right when soring on them (with same mapping)  
> but most now fails with same exception.
> 
> Is this i a bug or do I have to seek the answer somewhere in our  
> implementation of e.g storing data? We had no trouble with this using 0.20.6
> 
> ## greetings
> 
> Runar Myklebust

## -- mvh

Runar Myklebust

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 21, 2013, 2:22pm UTC](https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285/3 "2013-08-21T14:22:02Z")

</div>

I think this is related  
to [NPE in BytesRefOrdValComparator · Issue #3470 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3470)  
it should be fixed in the next release which is coming soon

simon

On Wednesday, August 21, 2013 3:40:46 PM UTC+2, Runar Myklebust wrote:

> Sorry, messed up some of the fieldnames here since i copy/pasted from  
> different tests, but the field name "position\_section\_1954.orderby" is  
> present in the exception, and the mapping is also for  
> position\_section\_1954.orderby.
> 
> On Wed, Aug 21, 2013 at 3:33 PM, Runar Myklebust \<[runa...@gmail.com](mailto:runa...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Im doing a test-upgrade on our product, embedding ES version 0.20.6 to  
> > 0.90.3
> > 
> > Suddenly, a lot of queries fails with NPE. Ive isolated the problem to  
> > happen on sorting on some (most) values:
> > 
> > Here is query i test on:
> > 
> > {  
> > "size": 0,  
> > "query": {  
> > "match\_all": {}  
> > },  
> > "sort" : {  
> > "position\_section\_1954.orderby" : {  
> > "ignore\_unmapped" : true  
> > }  
> > }  
> > }
> > 
> > which fails with exception:
> > 
> > {  
> > "error": "SearchPhaseExecutionException[Failed to execute phase  
> > [query], all shards failed; shardFailures  
> > {[ViFbnvtyQpG3oc04Mke8wA][cms][0]: QueryPhaseExecutionException[[cms][0]:  
> > query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> > org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
> > Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> > }{[ViFbnvtyQpG3oc04Mke8wA][cms][2]: QueryPhaseExecutionException[[cms][2]:  
> > query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> > org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
> > Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> > }{[ViFbnvtyQpG3oc04Mke8wA][cms][1]: QueryPhaseExecutionException[[cms][1]:  
> > query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> > org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@3a8f69ac\>]:  
> > Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> > }{[ViFbnvtyQpG3oc04Mke8wA][cms][3]: QueryPhaseExecutionException[[cms][3]:  
> > query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"position\_section\_1954":  
> > org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@19fb31ff\>]:  
> > Query Failed [Failed to execute main query]]; nested: NullPointerException;  
> > }]",  
> > "status": 500  
> > }
> > 
> > The mapping for this field is:
> > 
> > position\_section\_1845.orderby": {  
> > "type": "string",  
> > "index": "not\_analyzed",  
> > "omit\_norms": true,  
> > "index\_options": "docs"  
> > }
> > 
> > I see when debug that this happens because this line: Object ordsStorage  
> > = docToOrd.ordinals().getBackingStorage() in BytesRefOrdValComparator uses  
> > the MultiOrdinals-implementation where docToOrd.ordinals() always is null?  
> > Some other field works all right when soring on them (with same mapping)  
> > but most now fails with same exception.
> > 
> > Is this i a bug or do I have to seek the answer somewhere in our  
> > implementation of e.g storing data? We had no trouble with this using 0.20.6
> > 
> > ## greetings
> > 
> > Runar Myklebust
> 
> ## -- mvh
> 
> Runar Myklebust

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Runar\_Myklebust](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Runar\_Myklebust](https://discuss.elastic.co/u/Runar_Myklebust)\
**Post date:** [August 22, 2013, 7:59am UTC](https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285/4 "2013-08-22T07:59:27Z")

</div>

Yes, thanks, it works as expected in 0.90.4-SNAPSHOT.

Any idea if soon means within a week or two or within a month or two?

On Wed, Aug 21, 2013 at 4:22 PM, simonw  
[simon.willnauer@elasticsearch.com](mailto:simon.willnauer@elasticsearch.com)wrote:

> I think this is related to  
> [NPE in BytesRefOrdValComparator · Issue #3470 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3470)  
> it should be fixed in the next release which is coming soon
> 
> simon

--  
greetings  
Runar Myklebust

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 22, 2013, 12:57pm UTC](https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285/5 "2013-08-22T12:57:55Z")

</div>

our usual minor release cycle is 4 weeks so it should be relatively soon!  
thanks so much for checking / confirming!

simon

On Thursday, August 22, 2013 9:59:27 AM UTC+2, Runar Myklebust wrote:

> Yes, thanks, it works as expected in 0.90.4-SNAPSHOT.
> 
> Any idea if soon means within a week or two or within a month or two?
> 
> On Wed, Aug 21, 2013 at 4:22 PM, simonw \<[simon.w...@elasticsearch.com](mailto:simon.w...@elasticsearch.com)\<javascript:\>
> 
> > wrote:
> 
> > I think this is related to  
> > [NPE in BytesRefOrdValComparator · Issue #3470 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3470)  
> > it should be fixed in the next release which is coming soon
> > 
> > simon
> 
> --  
> greetings  
> Runar Myklebust

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:20am UTC](https://discuss.elastic.co/t/nullpointer-on-sort-version-0-90-3/13285/6 "2017-07-06T02:20:11Z")

</div>


