# Preloaded script fields in mvel

**URL:** <https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449>\
**Category:** Elasticsearch\
**Created:** [April 4, 2013, 11:46am UTC](https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449 "2013-04-04T11:46:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![waldemar](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@waldemar](https://discuss.elastic.co/u/waldemar)\
**Post date:** [April 4, 2013, 11:46am UTC](https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449/1 "2013-04-04T11:46:28Z")

</div>

Hi,

Forgive me lack of knowledge, but, can I create script fields which is  
preloaded ?

Because I don't want to send it (the script) with every query.

I have been reading documentation about scripting module, but the only  
info about pre-loading is for native (Java) language.

If there is a way to do that please provide an example.

Thank you in advance,

Waldemar

--  
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:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 4, 2013, 12:58pm UTC](https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449/2 "2013-04-04T12:58:25Z")

</div>

Hey

have you read the paragraph about preloaded scripts at

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

It uses a python script as example, not native java.  
You can put them in your config directory - but have to make sure they are  
on every node of your cluster then.

On Thu, Apr 4, 2013 at 1:46 PM, [waldemar@pureholidayhomes.com](mailto:waldemar@pureholidayhomes.com) wrote:

> Hi,
> 
> Forgive me lack of knowledge, but, can I create script fields which is  
> preloaded ?
> 
> Because I don't want to send it (the script) with every query.
> 
> I have been reading documentation about scripting module, but the only  
> info about pre-loading is for native (Java) language.
> 
> If there is a way to do that please provide an example.
> 
> Thank you in advance,
> 
> Waldemar
> 
> --  
> 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).

--  
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:** ![waldemar](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@waldemar](https://discuss.elastic.co/u/waldemar)\
**Post date:** [April 4, 2013, 1:15pm UTC](https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449/3 "2013-04-04T13:15:37Z")

</div>

Yes Alexander, as I mentioned earlier I have read that.

I can only add, that I've created mvel script under  
/config/scripts/hello\_m.mvel, but after executing:  
curl -XGET [http://localhost:9200/marzec/dziewietnascie/\_search](http://localhost:9200/marzec/dziewietnascie/_search)  
-d '{size:1, fields:["\_id"], "query":{"match\_all": {}},  
"script\_fields":{"test1":{"script":"hello\_m"}}}'

I get error:  
{"status":500,"reason":"PropertyAccessException[[Error: unresolvable  
property or identifier: hello\_m]\n[Near : {... hello\_m ....}

On Thursday, 4 April 2013 14:58:25 UTC+2, Alexander Reelsen wrote:

> Hey
> 
> have you read the paragraph about preloaded scripts at  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/scripting/)  
> It uses a python script as example, not native java.  
> You can put them in your config directory - but have to make sure they are  
> on every node of your cluster then.
> 
> On Thu, Apr 4, 2013 at 1:46 PM, \<[wald...@pureholidayhomes.com](mailto:wald...@pureholidayhomes.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi,
> > 
> > Forgive me lack of knowledge, but, can I create script fields which is  
> > preloaded ?
> > 
> > Because I don't want to send it (the script) with every query.
> > 
> > I have been reading documentation about scripting module, but the only  
> > info about pre-loading is for native (Java) language.
> > 
> > If there is a way to do that please provide an example.
> > 
> > Thank you in advance,
> > 
> > Waldemar
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 5, 2013, 1:56pm UTC](https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449/4 "2013-04-05T13:56:06Z")

</div>

Did you restart the cluster after creating the script?

On Thursday, April 4, 2013 9:15:37 AM UTC-4, [wald...@pureholidayhomes.com](mailto:wald...@pureholidayhomes.com)  
wrote:

> Yes Alexander, as I mentioned earlier I have read that.
> 
> I can only add, that I've created mvel script under  
> /config/scripts/hello\_m.mvel, but after executing:  
> curl -XGET [http://localhost:9200/marzec/dziewietnascie/\_search](http://localhost:9200/marzec/dziewietnascie/_search)  
> -d '{size:1, fields:["\_id"], "query":{"match\_all": {}},  
> "script\_fields":{"test1":{"script":"hello\_m"}}}'
> 
> I get error:  
> {"status":500,"reason":"PropertyAccessException[[Error: unresolvable  
> property or identifier: hello\_m]\n[Near : {... hello\_m ....}
> 
> On Thursday, 4 April 2013 14:58:25 UTC+2, Alexander Reelsen wrote:
> 
> > Hey
> > 
> > have you read the paragraph about preloaded scripts at  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/scripting/)  
> > It uses a python script as example, not native java.  
> > You can put them in your config directory - but have to make sure they  
> > are on every node of your cluster then.
> > 
> > On Thu, Apr 4, 2013 at 1:46 PM, [wald...@pureholidayhomes.com](mailto:wald...@pureholidayhomes.com) wrote:
> > 
> > > Hi,
> > > 
> > > Forgive me lack of knowledge, but, can I create script fields which is  
> > > preloaded ?
> > > 
> > > Because I don't want to send it (the script) with every query.
> > > 
> > > I have been reading documentation about scripting module, but the only  
> > > info about pre-loading is for native (Java) language.
> > > 
> > > If there is a way to do that please provide an example.
> > > 
> > > Thank you in advance,
> > > 
> > > Waldemar
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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:** ![waldemar](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@waldemar](https://discuss.elastic.co/u/waldemar)\
**Post date:** [April 5, 2013, 2:07pm UTC](https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449/5 "2013-04-05T14:07:10Z")

</div>

Wow Thanks Igor very, very much.  
earlier I did not restart the ES.  
But after your question I did, an it start working (on my linux server).  
But this is strange, because I did that on my windows server, and it did  
not take effect ☹

So, Thank you, very, very much 🙂 ,  
Waldemar

On Friday, 5 April 2013 15:56:06 UTC+2, Igor Motov wrote:

> Did you restart the cluster after creating the script?
> 
> On Thursday, April 4, 2013 9:15:37 AM UTC-4, wald...@pureholidayhomes.comwrote:
> 
> > Yes Alexander, as I mentioned earlier I have read that.
> > 
> > I can only add, that I've created mvel script under  
> > /config/scripts/hello\_m.mvel, but after executing:  
> > curl -XGET [http://localhost:9200/marzec/dziewietnascie/\_search](http://localhost:9200/marzec/dziewietnascie/_search)  
> > -d '{size:1, fields:["\_id"], "query":{"match\_all": {}},  
> > "script\_fields":{"test1":{"script":"hello\_m"}}}'
> > 
> > I get error:  
> > {"status":500,"reason":"PropertyAccessException[[Error: unresolvable  
> > property or identifier: hello\_m]\n[Near : {... hello\_m ....}
> > 
> > On Thursday, 4 April 2013 14:58:25 UTC+2, Alexander Reelsen wrote:
> > 
> > > Hey
> > > 
> > > have you read the paragraph about preloaded scripts at  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/scripting/)  
> > > It uses a python script as example, not native java.  
> > > You can put them in your config directory - but have to make sure they  
> > > are on every node of your cluster then.
> > > 
> > > On Thu, Apr 4, 2013 at 1:46 PM, [wald...@pureholidayhomes.com](mailto:wald...@pureholidayhomes.com) wrote:
> > > 
> > > > Hi,
> > > > 
> > > > Forgive me lack of knowledge, but, can I create script fields which  
> > > > is preloaded ?
> > > > 
> > > > Because I don't want to send it (the script) with every query.
> > > > 
> > > > I have been reading documentation about scripting module, but the  
> > > > only info about pre-loading is for native (Java) language.
> > > > 
> > > > If there is a way to do that please provide an example.
> > > > 
> > > > Thank you in advance,
> > > > 
> > > > Waldemar
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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:42am UTC](https://discuss.elastic.co/t/preloaded-script-fields-in-mvel/11449/6 "2017-07-06T02:42:37Z")

</div>


