# More Native Script help

**URL:** <https://discuss.elastic.co/t/more-native-script-help/4862>\
**Category:** Elasticsearch\
**Created:** [July 14, 2011, 4:07pm UTC](https://discuss.elastic.co/t/more-native-script-help/4862 "2011-07-14T16:07:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [July 14, 2011, 4:07pm UTC](https://discuss.elastic.co/t/more-native-script-help/4862/1 "2011-07-14T16:07:33Z")

</div>

Hi,

I have this config in my data node:

```
   https://gist.github.com/1082725

```

The "myLatestActivity" script is failing the "my" script is  
succeeding.

This is the error I'm getting:

```
https://gist.github.com/1082738

```

I am seeing debug of the "MyLatestActivitySorterFactory]" going  
through, so it is being hit, unfortunately 4 out of the 5 shards are  
failing for some reason.

Best Regards,

David.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 14, 2011, 10:53pm UTC](https://discuss.elastic.co/t/more-native-script-help/4862/2 "2011-07-14T22:53:08Z")

</div>

Do you see the failures in the logs? Can you gist those?

On Thursday, July 14, 2011 at 7:07 PM, davrob2 wrote:

> Hi,
> 
> I have this config in my data node:
> 
> [config.yml · GitHub](https://gist.github.com/1082725)
> 
> The "myLatestActivity" script is failing the "my" script is  
> succeeding.
> 
> This is the error I'm getting:
> 
> [error.json · GitHub](https://gist.github.com/1082738)
> 
> I am seeing debug of the "MyLatestActivitySorterFactory]" going  
> through, so it is being hit, unfortunately 4 out of the 5 shards are  
> failing for some reason.
> 
> Best Regards,
> 
> David.

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [July 19, 2011, 11:01am UTC](https://discuss.elastic.co/t/more-native-script-help/4862/3 "2011-07-19T11:01:28Z")

</div>

Hi Shay,

The logs show no exceptions, and only show the logging that I have  
included as part of my implementation of the  
AbstractFloatSearchScript.

> <https://gist.github.com/1091979>

Are there any log settings that I should loosen up to show exceptions?

Best Regards,

David.

On Jul 14, 11:53 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Do you see the failures in the logs? Can you gist those?
> 
> On Thursday, July 14, 2011 at 7:07 PM, davrob2 wrote:
> 
> > Hi,
> 
> > I have this config in my data node:
> 
> > [config.yml · GitHub](https://gist.github.com/1082725)
> 
> > The "myLatestActivity" script is failing the "my" script is  
> > succeeding.
> 
> > This is the error I'm getting:
> 
> > [error.json · GitHub](https://gist.github.com/1082738)
> 
> > I am seeing debug of the "MyLatestActivitySorterFactory]" going  
> > through, so it is being hit, unfortunately 4 out of the 5 shards are  
> > failing for some reason.
> 
> > Best Regards,
> 
> > David.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 19, 2011, 10:05pm UTC](https://discuss.elastic.co/t/more-native-script-help/4862/4 "2011-07-19T22:05:24Z")

</div>

Can you log if the factory classes for the scripts are getting created?

On Tue, Jul 19, 2011 at 2:01 PM, davrob2 [daviroberts@gmail.com](mailto:daviroberts@gmail.com) wrote:

> Hi Shay,
> 
> The logs show no exceptions, and only show the logging that I have  
> included as part of my implementation of the  
> AbstractFloatSearchScript.
> 
> [1091979’s gists · GitHub](https://gist.github.com/1091979)
> 
> Are there any log settings that I should loosen up to show exceptions?
> 
> Best Regards,
> 
> David.
> 
> On Jul 14, 11:53 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Do you see the failures in the logs? Can you gist those?
> > 
> > On Thursday, July 14, 2011 at 7:07 PM, davrob2 wrote:
> > 
> > > Hi,
> > 
> > > I have this config in my data node:
> > 
> > > [config.yml · GitHub](https://gist.github.com/1082725)
> > 
> > > The "myLatestActivity" script is failing the "my" script is  
> > > succeeding.
> > 
> > > This is the error I'm getting:
> > 
> > > [error.json · GitHub](https://gist.github.com/1082738)
> > 
> > > I am seeing debug of the "MyLatestActivitySorterFactory]" going  
> > > through, so it is being hit, unfortunately 4 out of the 5 shards are  
> > > failing for some reason.
> > 
> > > Best Regards,
> > 
> > > David.

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [July 20, 2011, 9:28am UTC](https://discuss.elastic.co/t/more-native-script-help/4862/5 "2011-07-20T09:28:28Z")

</div>

They are definitely being created and called, this log line shows the  
call:

[2011-07-19 06:54:19,264][INFO]  
[com.cs.cts.crm.elasticsearch.util.MyLatestActivitySorterFactory]  
MyLatest JSON...

This is the source of the script: [gist:1094650 · GitHub](https://gist.github.com/1094650)

On Jul 19, 11:05 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Can you log if the factory classes for the scripts are getting created?
> 
> On Tue, Jul 19, 2011 at 2:01 PM, davrob2 [davirobe...@gmail.com](mailto:davirobe...@gmail.com) wrote:
> 
> > Hi Shay,
> 
> > The logs show no exceptions, and only show the logging that I have  
> > included as part of my implementation of the  
> > AbstractFloatSearchScript.
> 
> > [1091979’s gists · GitHub](https://gist.github.com/1091979)
> 
> > Are there any log settings that I should loosen up to show exceptions?
> 
> > Best Regards,
> 
> > David.
> 
> > On Jul 14, 11:53 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Do you see the failures in the logs? Can you gist those?
> 
> > > On Thursday, July 14, 2011 at 7:07 PM, davrob2 wrote:
> > > 
> > > > Hi,
> 
> > > > I have this config in my data node:
> 
> > > > [config.yml · GitHub](https://gist.github.com/1082725)
> 
> > > > The "myLatestActivity" script is failing the "my" script is  
> > > > succeeding.
> 
> > > > This is the error I'm getting:
> 
> > > > [error.json · GitHub](https://gist.github.com/1082738)
> 
> > > > I am seeing debug of the "MyLatestActivitySorterFactory]" going  
> > > > through, so it is being hit, unfortunately 4 out of the 5 shards are  
> > > > failing for some reason.
> 
> > > > Best Regards,
> 
> > > > David.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 20, 2011, 8:57pm UTC](https://discuss.elastic.co/t/more-native-script-help/4862/6 "2011-07-20T20:57:36Z")

</div>

Strange..., can you jar up the classes you have, and post it somewhere where  
I can download it? With the config as well, and a script that recreates the  
problem.

On Wed, Jul 20, 2011 at 12:28 PM, davrob2 [daviroberts@gmail.com](mailto:daviroberts@gmail.com) wrote:

> They are definitely being created and called, this log line shows the  
> call:
> 
> [2011-07-19 06:54:19,264][INFO]  
> [com.cs.cts.crm.elasticsearch.util.MyLatestActivitySorterFactory]  
> MyLatest JSON...
> 
> This is the source of the script: [gist:1094650 · GitHub](https://gist.github.com/1094650)
> 
> On Jul 19, 11:05 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Can you log if the factory classes for the scripts are getting created?
> > 
> > On Tue, Jul 19, 2011 at 2:01 PM, davrob2 [davirobe...@gmail.com](mailto:davirobe...@gmail.com) wrote:
> > 
> > > Hi Shay,
> > 
> > > The logs show no exceptions, and only show the logging that I have  
> > > included as part of my implementation of the  
> > > AbstractFloatSearchScript.
> > 
> > > [1091979’s gists · GitHub](https://gist.github.com/1091979)
> > 
> > > Are there any log settings that I should loosen up to show exceptions?
> > 
> > > Best Regards,
> > 
> > > David.
> > 
> > > On Jul 14, 11:53 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > 
> > > > Do you see the failures in the logs? Can you gist those?
> > 
> > > > On Thursday, July 14, 2011 at 7:07 PM, davrob2 wrote:
> > > > 
> > > > > Hi,
> > 
> > > > > I have this config in my data node:
> > 
> > > > > [config.yml · GitHub](https://gist.github.com/1082725)
> > 
> > > > > The "myLatestActivity" script is failing the "my" script is  
> > > > > succeeding.
> > 
> > > > > This is the error I'm getting:
> > 
> > > > > [error.json · GitHub](https://gist.github.com/1082738)
> > 
> > > > > I am seeing debug of the "MyLatestActivitySorterFactory]" going  
> > > > > through, so it is being hit, unfortunately 4 out of the 5 shards  
> > > > > are  
> > > > > failing for some reason.
> > 
> > > > > Best Regards,
> > 
> > > > > David.

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [September 20, 2011, 2:50pm UTC](https://discuss.elastic.co/t/more-native-script-help/4862/7 "2011-09-20T14:50:19Z")

</div>

An update on this. My sorting class was throwing null pointer exceptions on the ElasticSearch Server.

Unfortunately, ES swallows all of these errors in its logs and just reports errors with the search.

To see what was causing the errors I needed to surround the top level method in my sorting class with a defensive try-catch and the using Log4j / Commons Logging to log my errors, which appear directly in the ElasticSearch console.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 24, 2011, 6:12pm UTC](https://discuss.elastic.co/t/more-native-script-help/4862/8 "2011-09-24T18:12:30Z")

</div>

Was it failing during the call to the script? That should fail and be  
reported as an error...

On Tue, Sep 20, 2011 at 5:50 PM, davrob [daviroberts@gmail.com](mailto:daviroberts@gmail.com) wrote:

> An update on this. My sorting class was throwing null pointer exceptions  
> on  
> the Elasticsearch Server.
> 
> Unfortunately, ES swallows all of these errors in its logs and just reports  
> errors with the search.
> 
> To see what was causing the errors I needed to surround the top level  
> method  
> in my sorting class with a defensive try-catch and the using Log4j /  
> Commons  
> Logging to log my errors, which appear directly in the Elasticsearch  
> console.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/More-Native-Script-help-tp3169582p3352288.html](http://elasticsearch-users.115913.n3.nabble.com/More-Native-Script-help-tp3169582p3352288.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 3:53am UTC](https://discuss.elastic.co/t/more-native-script-help/4862/9 "2017-07-06T03:53:37Z")

</div>


