# Sort script worked in 0.2 but does not in 0.9

**URL:** <https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414>\
**Category:** Elasticsearch\
**Created:** [August 30, 2013, 8:19pm UTC](https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414 "2013-08-30T20:19:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Larsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicholas_larsen/32/2118_2.png) [@Nicholas\_Larsen](https://discuss.elastic.co/u/Nicholas_Larsen)\
**Post date:** [August 30, 2013, 8:19pm UTC](https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414/1 "2013-08-30T20:19:24Z")

</div>

The following sort script used to work in 0.2 but now fails in 0.9:

{  
"\_script": {  
"script": "org.elasticsearch.common.Digest.md5Hex(doc['myId'].value +  
12345)",  
"type": "string",  
"order": "asc"  
}  
}

The error I am receiving is:

PropertyAccessException[[Error: unresolvable property or identifier: org]

I cannot figure out the correct words to use in order to google possible  
solutions to this problem. Any ideas to point me in the right direction  
would be much appreciated.

--  
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:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [September 6, 2013, 3:38pm UTC](https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414/2 "2013-09-06T15:38:53Z")

</div>

Hi,  
the problem is that the class you're referring to in your script has been  
deleted in 0.90. Here is the relevant  
commit: [cleanup · elastic/elasticsearch@4e66658 · GitHub](https://github.com/elasticsearch/elasticsearch/commit/4e66658aacbf693dc1f30ceaf19ee4983059effd)  
.

May I ask what you're trying to achieve with your script? I wonder if what  
you're doing is perhaps now possible without scripting.

Cheers  
Luca

On Friday, August 30, 2013 10:19:24 PM UTC+2, Nicholas Larsen wrote:

> The following sort script used to work in 0.2 but now fails in 0.9:
> 
> {  
> "\_script": {  
> "script": "org.elasticsearch.common.Digest.md5Hex(doc['myId'].value +  
> 12345)",  
> "type": "string",  
> "order": "asc"  
> }  
> }
> 
> The error I am receiving is:
> 
> PropertyAccessException[[Error: unresolvable property or identifier: org]
> 
> I cannot figure out the correct words to use in order to google possible  
> solutions to this problem. Any ideas to point me in the right direction  
> would be much appreciated.

--  
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:** ![h\_b\_wassenaar](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@h\_b\_wassenaar](https://discuss.elastic.co/u/h_b_wassenaar)\
**Post date:** [September 9, 2013, 7:15am UTC](https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414/3 "2013-09-09T07:15:36Z")

</div>

I've seem something like that script before on stackoverflow (

> <https://stackoverflow.com/questions/9796470/random-order-pagination-elasticsearch>

) The point is to have a randomlike sorting, but one that you can replicate  
(so you can page through the results in a meaningful way).

An alternative (from the same answer on SO) would be to use:

"script" : "(doc['\_id'].value + 12345).hashCode()"

regards,

```
        --harmen

```

On Friday, September 6, 2013 5:38:53 PM UTC+2, Luca Cavanna wrote:

> Hi,  
> the problem is that the class you're referring to in your script has been  
> deleted in 0.90. Here is the relevant commit:  
> [cleanup · elastic/elasticsearch@4e66658 · GitHub](https://github.com/elasticsearch/elasticsearch/commit/4e66658aacbf693dc1f30ceaf19ee4983059effd).
> 
> May I ask what you're trying to achieve with your script? I wonder if what  
> you're doing is perhaps now possible without scripting.
> 
> Cheers  
> Luca
> 
> On Friday, August 30, 2013 10:19:24 PM UTC+2, Nicholas Larsen wrote:
> 
> > The following sort script used to work in 0.2 but now fails in 0.9:
> > 
> > {  
> > "\_script": {  
> > "script": "org.elasticsearch.common.Digest.md5Hex(doc['myId'].value
> > 
> > - 12345)",  
> > "type": "string",  
> > "order": "asc"  
> > }  
> > }
> > 
> > The error I am receiving is:
> > 
> > PropertyAccessException[[Error: unresolvable property or identifier: org]
> > 
> > I cannot figure out the correct words to use in order to google possible  
> > solutions to this problem. Any ideas to point me in the right direction  
> > would be much appreciated.

--  
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:** ![Nicholas\_Larsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicholas_larsen/32/2118_2.png) [@Nicholas\_Larsen](https://discuss.elastic.co/u/Nicholas_Larsen)\
**Post date:** [September 9, 2013, 2:57pm UTC](https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414/4 "2013-09-09T14:57:39Z")

</div>

Thanks for looking at this question, but this also does not work in 0.90  
without a plugin.

On Monday, September 9, 2013 3:15:36 AM UTC-4, h.b.wa...@alumnus.rug.nl  
wrote:

> I've seem something like that script before on stackoverflow (  
> [Random order & pagination Elasticsearch - Stack Overflow](http://stackoverflow.com/questions/9796470/random-order-pagination-elasticsearch)) The point is to have a randomlike sorting, but one that you can replicate  
> (so you can page through the results in a meaningful way).
> 
> An alternative (from the same answer on SO) would be to use:
> 
> "script" : "(doc['\_id'].value + 12345).hashCode()"
> 
> regards,
> 
> ```
> --harmen
> 
> ```
> 
> On Friday, September 6, 2013 5:38:53 PM UTC+2, Luca Cavanna wrote:
> 
> > Hi,  
> > the problem is that the class you're referring to in your script has been  
> > deleted in 0.90. Here is the relevant commit:  
> > [cleanup · elastic/elasticsearch@4e66658 · GitHub](https://github.com/elasticsearch/elasticsearch/commit/4e66658aacbf693dc1f30ceaf19ee4983059effd).
> > 
> > May I ask what you're trying to achieve with your script? I wonder if  
> > what you're doing is perhaps now possible without scripting.
> > 
> > Cheers  
> > Luca
> > 
> > On Friday, August 30, 2013 10:19:24 PM UTC+2, Nicholas Larsen wrote:
> > 
> > > The following sort script used to work in 0.2 but now fails in 0.9:
> > > 
> > > {  
> > > "\_script": {  
> > > "script": "org.elasticsearch.common.Digest.md5Hex(doc['myId'].value
> > > 
> > > - 12345)",  
> > > "type": "string",  
> > > "order": "asc"  
> > > }  
> > > }
> > > 
> > > The error I am receiving is:
> > > 
> > > PropertyAccessException[[Error: unresolvable property or identifier: org  
> > > ]
> > > 
> > > I cannot figure out the correct words to use in order to google possible  
> > > solutions to this problem. Any ideas to point me in the right direction  
> > > would be much appreciated.

--  
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:** ![Nicholas\_Larsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicholas_larsen/32/2118_2.png) [@Nicholas\_Larsen](https://discuss.elastic.co/u/Nicholas_Larsen)\
**Post date:** [September 9, 2013, 2:58pm UTC](https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414/5 "2013-09-09T14:58:49Z")

</div>

This is what I was looking for, thank you. And for anyone who runs into  
this problem later, the discussion moved to stack overflow[http://stackoverflow.com/questions/18541354/elastic-search-sort-script-not-working-after-upgrade](http://stackoverflow.com/questions/18541354/elastic-search-sort-script-not-working-after-upgrade)  
.

On Friday, September 6, 2013 11:38:53 AM UTC-4, Luca Cavanna wrote:

> Hi,  
> the problem is that the class you're referring to in your script has been  
> deleted in 0.90. Here is the relevant commit:  
> [cleanup · elastic/elasticsearch@4e66658 · GitHub](https://github.com/elasticsearch/elasticsearch/commit/4e66658aacbf693dc1f30ceaf19ee4983059effd).
> 
> May I ask what you're trying to achieve with your script? I wonder if what  
> you're doing is perhaps now possible without scripting.
> 
> Cheers  
> Luca
> 
> On Friday, August 30, 2013 10:19:24 PM UTC+2, Nicholas Larsen wrote:
> 
> > The following sort script used to work in 0.2 but now fails in 0.9:
> > 
> > {  
> > "\_script": {  
> > "script": "org.elasticsearch.common.Digest.md5Hex(doc['myId'].value
> > 
> > - 12345)",  
> > "type": "string",  
> > "order": "asc"  
> > }  
> > }
> > 
> > The error I am receiving is:
> > 
> > PropertyAccessException[[Error: unresolvable property or identifier: org]
> > 
> > I cannot figure out the correct words to use in order to google possible  
> > solutions to this problem. Any ideas to point me in the right direction  
> > would be much appreciated.

--  
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:17am UTC](https://discuss.elastic.co/t/sort-script-worked-in-0-2-but-does-not-in-0-9/13414/6 "2017-07-06T02:17:29Z")

</div>


