# Custom functions for query

**URL:** <https://discuss.elastic.co/t/custom-functions-for-query/14728>\
**Category:** Elasticsearch\
**Created:** [December 5, 2013, 1:14pm UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728 "2013-12-05T13:14:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [December 5, 2013, 1:14pm UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/1 "2013-12-05T13:14:29Z")

</div>

Hi All,

I want to use some custom functions in elastic-search query.

I want to write my own function and use that while searching the records in  
elastic-search.

for example:  
i have a field "field1" having double value. Now i want to get all records  
matching some conditions and also get cuberoot of field1 in each record.

Logical query for same will look like:  
select \*, cuberoot("field1") from index where condition1 and condition2;

## Other example:

i have a field "field2" having string value. Now i want to get all records  
matching some conditions and also get reverse of field2 in each record.

Logical query for same will look like:  
select \*, reverse("field2") from index where condition1 and condition2;

There are some inbuilt mvel functions as mention  
here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that  
can be used within scripts. I want to use some custom function in  
similar way of mvel inbuilt functions.

Is it possible to register some custom functions for query ?

Any suggestions would me really helpful.

--  
_Thanks & Regards_  
_Hanish Bansal_

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [December 5, 2013, 8:42pm UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/2 "2013-12-05T20:42:30Z")

</div>

Hi Hanish,

Have you read on

> **[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 should be possible to change to other language other than mvel

> **[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.

These are some supported scripts

> **[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.

HTH

/Jason

On Thu, Dec 5, 2013 at 9:14 PM, Hanish Bansal \<  
[hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:

> Hi All,
> 
> I want to use some custom functions in elastic-search query.
> 
> I want to write my own function and use that while searching the records  
> in elastic-search.
> 
> for example:  
> i have a field "field1" having double value. Now i want to get all records  
> matching some conditions and also get cuberoot of field1 in each record.
> 
> Logical query for same will look like:  
> select \*, cuberoot("field1") from index where condition1 and condition2;
> 
> ## Other example:
> 
> i have a field "field2" having string value. Now i want to get all records  
> matching some conditions and also get reverse of field2 in each record.
> 
> Logical query for same will look like:  
> select \*, reverse("field2") from index where condition1 and condition2;
> 
> There are some inbuilt mvel functions as mention here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that can be used within scripts. I want to use some custom function in  
> similar way of mvel inbuilt functions.
> 
> Is it possible to register some custom functions for query ?
> 
> Any suggestions would me really helpful.
> 
> --  
> _Thanks & Regards_  
> _Hanish Bansal_
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [December 6, 2013, 6:44am UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/3 "2013-12-06T06:44:07Z")

</div>

Thanks for response Jason !!

I gone through above links. My understanding is that we will have to do  
below thing for this use case:

1. Create a script in any supported lang. Write a custom function(lets say  
in javascript lang) for reverse a string:

function reverse(s) {  
return s.split('').reverse().join('');  
}

create a script file for this "reverse.js"

1. Put this script file into config/scripts

2. I''ll also need to install javascript lang plugin to support scripts  
written in javascript function.

3. restart ES if i am using lower version than 0.90.6.

Using this i should be able to use custom function in my query.

Correct me i am missing anything.

Also i am not clear that how to use those functions in query. It would be  
really helpful if you could put some examples for same.

On Thu, Dec 5, 2013 at 8:42 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:

> Hi Hanish,
> 
> Have you read on  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_preloaded_scripts)  
> ?
> 
> It should be possible to change to other language other than mvel  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_default_scripting_language)
> 
> These are some supported scripts  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html#scripting)
> 
> HTH
> 
> /Jason
> 
> On Thu, Dec 5, 2013 at 9:14 PM, Hanish Bansal \<  
> [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> 
> > Hi All,
> > 
> > I want to use some custom functions in elastic-search query.
> > 
> > I want to write my own function and use that while searching the records  
> > in elastic-search.
> > 
> > for example:  
> > i have a field "field1" having double value. Now i want to get all  
> > records matching some conditions and also get cuberoot of field1 in each  
> > record.
> > 
> > Logical query for same will look like:  
> > select \*, cuberoot("field1") from index where condition1 and condition2;
> > 
> > ## Other example:
> > 
> > i have a field "field2" having string value. Now i want to get all  
> > records matching some conditions and also get reverse of field2 in each  
> > record.
> > 
> > Logical query for same will look like:  
> > select \*, reverse("field2") from index where condition1 and condition2;
> > 
> > There are some inbuilt mvel functions as mention here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that can be used within scripts. I want to use some custom function in  
> > similar way of mvel inbuilt functions.
> > 
> > Is it possible to register some custom functions for query ?
> > 
> > Any suggestions would me really helpful.
> > 
> > --  
> > _Thanks & Regards_  
> > _Hanish Bansal_
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
_Thanks & Regards_  
_Hanish Bansal_

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4\_kYBZVyCyeGy1kt0gcjr2Y\_%2Bh0vqQsiAvFPGQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4_kYBZVyCyeGy1kt0gcjr2Y_%2Bh0vqQsiAvFPGQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [December 6, 2013, 2:44pm UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/4 "2013-12-06T14:44:48Z")

</div>

Hi Hanish,

You have collectively listed steps to perform, why don't try it and see? if  
you stumble upon problems, that's when you get to learn really.

To help in your journey, please read the link below, there are a few  
example,

> **[GitHub - imotov/elasticsearch-native-script-example: Example of Now...](https://github.com/imotov/elasticsearch-native-script-example)**
>
> Example of Now Deprecated Native Script Plugin for Elasticsearch - GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch

> **[GitHub - imotov/elasticsearch-facet-script: Fully Scriptable Facets for...](https://github.com/imotov/elasticsearch-facet-script)**
>
> Fully Scriptable Facets for ElasticSearch. Contribute to imotov/elasticsearch-facet-script development by creating an account on GitHub.

> **[Into the Sunset: Bintray, JCenter, GoCenter, and ChartCenter](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/)**
>
> To streamline the productivity of the JFrog Platform we will be sunsetting Bintray (including JCenter), GoCenter, and ChartCenter services on May 1st, 2021.

[http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html](http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html)

That should help in your journey and good luck!

/Jason

On Fri, Dec 6, 2013 at 2:44 PM, Hanish Bansal \<  
[hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:

> Thanks for response Jason !!
> 
> I gone through above links. My understanding is that we will have to do  
> below thing for this use case:
> 
> 1. Create a script in any supported lang. Write a custom function(lets  
> say in javascript lang) for reverse a string:
> 
> function reverse(s) {  
> return s.split('').reverse().join('');  
> }
> 
> create a script file for this "reverse.js"
> 
> 1. Put this script file into config/scripts
> 
> 2. I''ll also need to install javascript lang plugin to support scripts  
> written in javascript function.
> 
> 3. restart ES if i am using lower version than 0.90.6.
> 
> Using this i should be able to use custom function in my query.
> 
> Correct me i am missing anything.
> 
> Also i am not clear that how to use those functions in query. It would be  
> really helpful if you could put some examples for same.
> 
> On Thu, Dec 5, 2013 at 8:42 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> 
> > Hi Hanish,
> > 
> > Have you read on  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_preloaded_scripts)  
> > ?
> > 
> > It should be possible to change to other language other than mvel  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_default_scripting_language)
> > 
> > These are some supported scripts  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html#scripting)
> > 
> > HTH
> > 
> > /Jason
> > 
> > On Thu, Dec 5, 2013 at 9:14 PM, Hanish Bansal \<  
> > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > 
> > > Hi All,
> > > 
> > > I want to use some custom functions in elastic-search query.
> > > 
> > > I want to write my own function and use that while searching the records  
> > > in elastic-search.
> > > 
> > > for example:  
> > > i have a field "field1" having double value. Now i want to get all  
> > > records matching some conditions and also get cuberoot of field1 in each  
> > > record.
> > > 
> > > Logical query for same will look like:  
> > > select \*, cuberoot("field1") from index where condition1 and condition2;
> > > 
> > > ## Other example:
> > > 
> > > i have a field "field2" having string value. Now i want to get all  
> > > records matching some conditions and also get reverse of field2 in each  
> > > record.
> > > 
> > > Logical query for same will look like:  
> > > select \*, reverse("field2") from index where condition1 and condition2;
> > > 
> > > There are some inbuilt mvel functions as mention here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that can be used within scripts. I want to use some custom function in  
> > > similar way of mvel inbuilt functions.
> > > 
> > > Is it possible to register some custom functions for query ?
> > > 
> > > Any suggestions would me really helpful.
> > > 
> > > --  
> > > _Thanks & Regards_  
> > > _Hanish Bansal_
> > > 
> > > --  
> > > 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).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> _Thanks & Regards_  
> _Hanish Bansal_
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4\_kYBZVyCyeGy1kt0gcjr2Y\_%2Bh0vqQsiAvFPGQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4_kYBZVyCyeGy1kt0gcjr2Y_%2Bh0vqQsiAvFPGQ%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX\_gbo4EPm\_hw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX_gbo4EPm_hw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [December 9, 2013, 2:13pm UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/5 "2013-12-09T14:13:26Z")

</div>

Hi Jason,

Thanks for sharing the useful links.

I am trying to install sample plugin of native scripts given here  
[GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example) but i am  
getting below exception:

- 
  - 

> Installing native-script-example...Failed to install  
> native-script-example, reason: no protocol: ../elasticsearch-native-\*  
> \*script-example-master/target/\*_releases/elasticsearch-native-_  
> \*script-example-1.1.1-SNAPSHOT.\*_zip_

Command used to install plugin is:

bin/plugin -i native-script-example -u  
../elasticsearch-native-script-example-master/target/releases/elasticsearch-native-script-example-1.1.1-SNAPSHOT.zip

Name of plugin is "native-script-example" as mentioned in plugin class "  
NativeScriptExamplesPlugin".

Please help!!

On Fri, Dec 6, 2013 at 2:44 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:

> Hi Hanish,
> 
> You have collectively listed steps to perform, why don't try it and see?  
> if you stumble upon problems, that's when you get to learn really.
> 
> To help in your journey, please read the link below, there are a few  
> example,  
> [GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example)  
> [GitHub - imotov/elasticsearch-facet-script: Fully Scriptable Facets for ElasticSearch](https://github.com/imotov/elasticsearch-facet-script)
> 
> [Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog](https://bintray.com/imotov/elasticsearch-plugins/elasticsearch-native-script-example)
> 
> [http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html](http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html)
> 
> That should help in your journey and good luck!
> 
> /Jason
> 
> On Fri, Dec 6, 2013 at 2:44 PM, Hanish Bansal \<  
> [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> 
> > Thanks for response Jason !!
> > 
> > I gone through above links. My understanding is that we will have to do  
> > below thing for this use case:
> > 
> > 1. Create a script in any supported lang. Write a custom function(lets  
> > say in javascript lang) for reverse a string:
> > 
> > function reverse(s) {  
> > return s.split('').reverse().join('');  
> > }
> > 
> > create a script file for this "reverse.js"
> > 
> > 1. Put this script file into config/scripts
> > 
> > 2. I''ll also need to install javascript lang plugin to support scripts  
> > written in javascript function.
> > 
> > 3. restart ES if i am using lower version than 0.90.6.
> > 
> > Using this i should be able to use custom function in my query.
> > 
> > Correct me i am missing anything.
> > 
> > Also i am not clear that how to use those functions in query. It would be  
> > really helpful if you could put some examples for same.
> > 
> > On Thu, Dec 5, 2013 at 8:42 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> > 
> > > Hi Hanish,
> > > 
> > > Have you read on  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_preloaded_scripts)  
> > > ?
> > > 
> > > It should be possible to change to other language other than mvel  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_default_scripting_language)
> > > 
> > > These are some supported scripts  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html#scripting)
> > > 
> > > HTH
> > > 
> > > /Jason
> > > 
> > > On Thu, Dec 5, 2013 at 9:14 PM, Hanish Bansal \<  
> > > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > > 
> > > > Hi All,
> > > > 
> > > > I want to use some custom functions in elastic-search query.
> > > > 
> > > > I want to write my own function and use that while searching the  
> > > > records in elastic-search.
> > > > 
> > > > for example:  
> > > > i have a field "field1" having double value. Now i want to get all  
> > > > records matching some conditions and also get cuberoot of field1 in each  
> > > > record.
> > > > 
> > > > Logical query for same will look like:  
> > > > select \*, cuberoot("field1") from index where condition1 and condition2;
> > > > 
> > > > ## Other example:
> > > > 
> > > > i have a field "field2" having string value. Now i want to get all  
> > > > records matching some conditions and also get reverse of field2 in each  
> > > > record.
> > > > 
> > > > Logical query for same will look like:  
> > > > select \*, reverse("field2") from index where condition1 and condition2;
> > > > 
> > > > There are some inbuilt mvel functions as mention here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that can be used within scripts. I want to use some custom function in  
> > > > similar way of mvel inbuilt functions.
> > > > 
> > > > Is it possible to register some custom functions for query ?
> > > > 
> > > > Any suggestions would me really helpful.
> > > > 
> > > > --  
> > > > _Thanks & Regards_  
> > > > _Hanish Bansal_
> > > > 
> > > > --  
> > > > 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).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.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).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com)  
> > > .  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > _Thanks & Regards_  
> > _Hanish Bansal_
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4\_kYBZVyCyeGy1kt0gcjr2Y\_%2Bh0vqQsiAvFPGQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4_kYBZVyCyeGy1kt0gcjr2Y_%2Bh0vqQsiAvFPGQ%40mail.gmail.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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX\_gbo4EPm\_hw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX_gbo4EPm_hw%40mail.gmail.com)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
_Thanks & Regards_  
_Hanish Bansal_

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC\_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 10, 2013, 5:12am UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/6 "2013-12-10T05:12:31Z")

</div>

You cannot install a Java plugin directly from Github. You would need to  
build it yourself (following the instructions) and install the resulting  
binary.

--  
Ivan

On Mon, Dec 9, 2013 at 6:13 AM, Hanish Bansal \<  
[hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:

> Hi Jason,
> 
> Thanks for sharing the useful links.
> 
> I am trying to install sample plugin of native scripts given here  
> [GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example) but i am  
> getting below exception:
> 
> - 
> - 
> 
> > Installing native-script-example...Failed to install  
> > native-script-example, reason: no protocol: ../elasticsearch-native-\*  
> > \*script-example-master/target/\*_releases/elasticsearch-native-_  
> > \*script-example-1.1.1-SNAPSHOT.\*_zip_
> 
> Command used to install plugin is:
> 
> bin/plugin -i native-script-example -u  
> ../elasticsearch-native-script-example-master/target/releases/elasticsearch-native-script-example-1.1.1-SNAPSHOT.zip
> 
> Name of plugin is "native-script-example" as mentioned in plugin class "  
> NativeScriptExamplesPlugin".
> 
> Please help!!
> 
> On Fri, Dec 6, 2013 at 2:44 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> 
> > Hi Hanish,
> > 
> > You have collectively listed steps to perform, why don't try it and see?  
> > if you stumble upon problems, that's when you get to learn really.
> > 
> > To help in your journey, please read the link below, there are a few  
> > example,  
> > [GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example)  
> > [GitHub - imotov/elasticsearch-facet-script: Fully Scriptable Facets for ElasticSearch](https://github.com/imotov/elasticsearch-facet-script)
> > 
> > [Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog](https://bintray.com/imotov/elasticsearch-plugins/elasticsearch-native-script-example)
> > 
> > [http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html](http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html)
> > 
> > That should help in your journey and good luck!
> > 
> > /Jason
> > 
> > On Fri, Dec 6, 2013 at 2:44 PM, Hanish Bansal \<  
> > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > 
> > > Thanks for response Jason !!
> > > 
> > > I gone through above links. My understanding is that we will have to do  
> > > below thing for this use case:
> > > 
> > > 1. Create a script in any supported lang. Write a custom function(lets  
> > > say in javascript lang) for reverse a string:
> > > 
> > > function reverse(s) {  
> > > return s.split('').reverse().join('');  
> > > }
> > > 
> > > create a script file for this "reverse.js"
> > > 
> > > 1. Put this script file into config/scripts
> > > 
> > > 2. I''ll also need to install javascript lang plugin to support scripts  
> > > written in javascript function.
> > > 
> > > 3. restart ES if i am using lower version than 0.90.6.
> > > 
> > > Using this i should be able to use custom function in my query.
> > > 
> > > Correct me i am missing anything.
> > > 
> > > Also i am not clear that how to use those functions in query. It would  
> > > be really helpful if you could put some examples for same.
> > > 
> > > On Thu, Dec 5, 2013 at 8:42 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> > > 
> > > > Hi Hanish,
> > > > 
> > > > Have you read on  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_preloaded_scripts)  
> > > > ?
> > > > 
> > > > It should be possible to change to other language other than mvel  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_default_scripting_language)
> > > > 
> > > > These are some supported scripts  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html#scripting)
> > > > 
> > > > HTH
> > > > 
> > > > /Jason
> > > > 
> > > > On Thu, Dec 5, 2013 at 9:14 PM, Hanish Bansal \<  
> > > > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > > > 
> > > > > Hi All,
> > > > > 
> > > > > I want to use some custom functions in elastic-search query.
> > > > > 
> > > > > I want to write my own function and use that while searching the  
> > > > > records in elastic-search.
> > > > > 
> > > > > for example:  
> > > > > i have a field "field1" having double value. Now i want to get all  
> > > > > records matching some conditions and also get cuberoot of field1 in each  
> > > > > record.
> > > > > 
> > > > > Logical query for same will look like:  
> > > > > select \*, cuberoot("field1") from index where condition1 and  
> > > > > condition2;
> > > > > 
> > > > > ## Other example:
> > > > > 
> > > > > i have a field "field2" having string value. Now i want to get all  
> > > > > records matching some conditions and also get reverse of field2 in each  
> > > > > record.
> > > > > 
> > > > > Logical query for same will look like:  
> > > > > select \*, reverse("field2") from index where condition1 and condition2;
> > > > > 
> > > > > There are some inbuilt mvel functions as mention here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that can be used within scripts. I want to use some custom function in  
> > > > > similar way of mvel inbuilt functions.
> > > > > 
> > > > > Is it possible to register some custom functions for query ?
> > > > > 
> > > > > Any suggestions would me really helpful.
> > > > > 
> > > > > --  
> > > > > _Thanks & Regards_  
> > > > > _Hanish Bansal_
> > > > > 
> > > > > --  
> > > > > 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).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.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).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > _Thanks & Regards_  
> > > _Hanish Bansal_
> > > 
> > > --  
> > > 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).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4\_kYBZVyCyeGy1kt0gcjr2Y\_%2Bh0vqQsiAvFPGQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4_kYBZVyCyeGy1kt0gcjr2Y_%2Bh0vqQsiAvFPGQ%40mail.gmail.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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX\_gbo4EPm\_hw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX_gbo4EPm_hw%40mail.gmail.com)  
> > .
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> _Thanks & Regards_  
> _Hanish Bansal_
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC\_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBQER0DUigqJv9yYr8vR7eUhj9wDQvAMnJoQzyUDz77dg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBQER0DUigqJv9yYr8vR7eUhj9wDQvAMnJoQzyUDz77dg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [December 11, 2013, 3:03am UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/7 "2013-12-11T03:03:58Z")

</div>

HI lvan,

I build that following instructions using mvn package command and then i  
tried to install bundle plugin using install command. I was able to  
successfully build it but i was getting error while installing that.

Instructions on shared link  
[https://github.com/imotov/elasticsearch-native-script-example#creating-elasticsearch-plugin](https://github.com/imotov/elasticsearch-native-script-example#creating-elasticsearch-plugin)  
is:

_The plugin can be built using mvn package command. The assembled .zip  
package can be found in the target/releases/ directory and deployed to  
elasticsearch installation using plugin -install plugin-name -url  
path/to/plugin/zip/file._

If i manually copy the extracted zip file into plugin directory of  
elasticsearch and make entry of script factory class in elasticsearch.yml  
(using script.native.my.type) then i am able to use native scripts. The  
error comes only when i install that as plugin.

On Tue, Dec 10, 2013 at 10:42 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> You cannot install a Java plugin directly from Github. You would need to  
> build it yourself (following the instructions) and install the resulting  
> binary.
> 
> --  
> Ivan
> 
> On Mon, Dec 9, 2013 at 6:13 AM, Hanish Bansal \<  
> [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> 
> > Hi Jason,
> > 
> > Thanks for sharing the useful links.
> > 
> > I am trying to install sample plugin of native scripts given here  
> > [GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example) but i am  
> > getting below exception:
> > 
> > - 
> > - 
> > 
> > > Installing native-script-example...Failed to install  
> > > native-script-example, reason: no protocol: ../elasticsearch-native-\*  
> > > \*script-example-master/target/\*_releases/elasticsearch-native-_  
> > > \*script-example-1.1.1-SNAPSHOT.\*_zip_
> > 
> > Command used to install plugin is:
> > 
> > bin/plugin -i native-script-example -u  
> > ../elasticsearch-native-script-example-master/target/releases/elasticsearch-native-script-example-1.1.1-SNAPSHOT.zip
> > 
> > Name of plugin is "native-script-example" as mentioned in plugin class "  
> > NativeScriptExamplesPlugin".
> > 
> > Please help!!
> > 
> > On Fri, Dec 6, 2013 at 2:44 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> > 
> > > Hi Hanish,
> > > 
> > > You have collectively listed steps to perform, why don't try it and see?  
> > > if you stumble upon problems, that's when you get to learn really.
> > > 
> > > To help in your journey, please read the link below, there are a few  
> > > example,  
> > > [GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example)  
> > > [GitHub - imotov/elasticsearch-facet-script: Fully Scriptable Facets for ElasticSearch](https://github.com/imotov/elasticsearch-facet-script)
> > > 
> > > [Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog](https://bintray.com/imotov/elasticsearch-plugins/elasticsearch-native-script-example)
> > > 
> > > [http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html](http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html)
> > > 
> > > That should help in your journey and good luck!
> > > 
> > > /Jason
> > > 
> > > On Fri, Dec 6, 2013 at 2:44 PM, Hanish Bansal \<  
> > > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > > 
> > > > Thanks for response Jason !!
> > > > 
> > > > I gone through above links. My understanding is that we will have to do  
> > > > below thing for this use case:
> > > > 
> > > > 1. Create a script in any supported lang. Write a custom function(lets  
> > > > say in javascript lang) for reverse a string:
> > > > 
> > > > function reverse(s) {  
> > > > return s.split('').reverse().join('');  
> > > > }
> > > > 
> > > > create a script file for this "reverse.js"
> > > > 
> > > > 1. Put this script file into config/scripts
> > > > 
> > > > 2. I''ll also need to install javascript lang plugin to support scripts  
> > > > written in javascript function.
> > > > 
> > > > 3. restart ES if i am using lower version than 0.90.6.
> > > > 
> > > > Using this i should be able to use custom function in my query.
> > > > 
> > > > Correct me i am missing anything.
> > > > 
> > > > Also i am not clear that how to use those functions in query. It would  
> > > > be really helpful if you could put some examples for same.
> > > > 
> > > > On Thu, Dec 5, 2013 at 8:42 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> > > > 
> > > > > Hi Hanish,
> > > > > 
> > > > > Have you read on  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_preloaded_scripts)  
> > > > > ?
> > > > > 
> > > > > It should be possible to change to other language other than mvel  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_default_scripting_language)
> > > > > 
> > > > > These are some supported scripts  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html#scripting)
> > > > > 
> > > > > HTH
> > > > > 
> > > > > /Jason
> > > > > 
> > > > > On Thu, Dec 5, 2013 at 9:14 PM, Hanish Bansal \<  
> > > > > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > > > > 
> > > > > > Hi All,
> > > > > > 
> > > > > > I want to use some custom functions in elastic-search query.
> > > > > > 
> > > > > > I want to write my own function and use that while searching the  
> > > > > > records in elastic-search.
> > > > > > 
> > > > > > for example:  
> > > > > > i have a field "field1" having double value. Now i want to get all  
> > > > > > records matching some conditions and also get cuberoot of field1 in each  
> > > > > > record.
> > > > > > 
> > > > > > Logical query for same will look like:  
> > > > > > select \*, cuberoot("field1") from index where condition1 and  
> > > > > > condition2;
> > > > > > 
> > > > > > ## Other example:
> > > > > > 
> > > > > > i have a field "field2" having string value. Now i want to get all  
> > > > > > records matching some conditions and also get reverse of field2 in each  
> > > > > > record.
> > > > > > 
> > > > > > Logical query for same will look like:  
> > > > > > select \*, reverse("field2") from index where condition1 and  
> > > > > > condition2;
> > > > > > 
> > > > > > There are some inbuilt mvel functions as mention here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that can be used within scripts. I want to use some custom function in  
> > > > > > similar way of mvel inbuilt functions.
> > > > > > 
> > > > > > Is it possible to register some custom functions for query ?
> > > > > > 
> > > > > > Any suggestions would me really helpful.
> > > > > > 
> > > > > > --  
> > > > > > _Thanks & Regards_  
> > > > > > _Hanish Bansal_
> > > > > > 
> > > > > > --  
> > > > > > 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).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.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).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > > 
> > > > --  
> > > > _Thanks & Regards_  
> > > > _Hanish Bansal_
> > > > 
> > > > --  
> > > > 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).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4\_kYBZVyCyeGy1kt0gcjr2Y\_%2Bh0vqQsiAvFPGQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4_kYBZVyCyeGy1kt0gcjr2Y_%2Bh0vqQsiAvFPGQ%40mail.gmail.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).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX\_gbo4EPm\_hw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX_gbo4EPm_hw%40mail.gmail.com)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > _Thanks & Regards_  
> > _Hanish Bansal_
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC\_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBQER0DUigqJv9yYr8vR7eUhj9wDQvAMnJoQzyUDz77dg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBQER0DUigqJv9yYr8vR7eUhj9wDQvAMnJoQzyUDz77dg%40mail.gmail.com)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
_Thanks & Regards_  
_Hanish Bansal_

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8aTV5MnHk\_tfoiwouwVjdqXOmtva1NXUkgebH9WMiZusQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8aTV5MnHk_tfoiwouwVjdqXOmtva1NXUkgebH9WMiZusQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 11, 2013, 5:41pm UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/8 "2013-12-11T17:41:47Z")

</div>

I never really looked at that plugin, the build process is much more  
complicated than normal. 🙂

What the bin/plugin script basically does is downloaded the zip file (if  
necessary) and unzip it into the correct location in the plugins directory.  
What you normally end up with for Java plugins is a subdirectory with  
various jar files, including one with an es-plugin.properties file.

If you want to bypass the plugin script, simply unzip the zip file into a  
subdirectory inside plugins. There is not much magic involved with plugin  
script. Since I have never built that plugin (I should really look into  
it), can you sure what the contents of the zip file looks like?

Cheers,

Ivan

On Tue, Dec 10, 2013 at 7:03 PM, Hanish Bansal \<  
[hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:

> HI lvan,
> 
> I build that following instructions using mvn package command and then i  
> tried to install bundle plugin using install command. I was able to  
> successfully build it but i was getting error while installing that.
> 
> Instructions on shared link  
> [https://github.com/imotov/elasticsearch-native-script-example#creating-elasticsearch-plugin](https://github.com/imotov/elasticsearch-native-script-example#creating-elasticsearch-plugin)  
> is:
> 
> _The plugin can be built using mvn package command. The assembled .zip  
> package can be found in the target/releases/ directory and deployed to  
> elasticsearch installation using plugin -install plugin-name -url  
> path/to/plugin/zip/file._
> 
> If i manually copy the extracted zip file into plugin directory of  
> elasticsearch and make entry of script factory class in elasticsearch.yml  
> (using script.native.my.type) then i am able to use native scripts. The  
> error comes only when i install that as plugin.
> 
> On Tue, Dec 10, 2013 at 10:42 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > You cannot install a Java plugin directly from Github. You would need to  
> > build it yourself (following the instructions) and install the resulting  
> > binary.
> > 
> > --  
> > Ivan
> > 
> > On Mon, Dec 9, 2013 at 6:13 AM, Hanish Bansal \<  
> > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > 
> > > Hi Jason,
> > > 
> > > Thanks for sharing the useful links.
> > > 
> > > I am trying to install sample plugin of native scripts given here  
> > > [GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example) but i am  
> > > getting below exception:
> > > 
> > > - 
> > > - 
> > > 
> > > > Installing native-script-example...Failed to install  
> > > > native-script-example, reason: no protocol: ../elasticsearch-native-\*  
> > > > \*script-example-master/target/\*_releases/elasticsearch-native-_  
> > > > \*script-example-1.1.1-SNAPSHOT.\*_zip_
> > > 
> > > Command used to install plugin is:
> > > 
> > > bin/plugin -i native-script-example -u  
> > > ../elasticsearch-native-script-example-master/target/releases/elasticsearch-native-script-example-1.1.1-SNAPSHOT.zip
> > > 
> > > Name of plugin is "native-script-example" as mentioned in plugin class "  
> > > NativeScriptExamplesPlugin".
> > > 
> > > Please help!!
> > > 
> > > On Fri, Dec 6, 2013 at 2:44 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> > > 
> > > > Hi Hanish,
> > > > 
> > > > You have collectively listed steps to perform, why don't try it and  
> > > > see? if you stumble upon problems, that's when you get to learn really.
> > > > 
> > > > To help in your journey, please read the link below, there are a few  
> > > > example,  
> > > > [GitHub - imotov/elasticsearch-native-script-example: Example of Now Deprecated Native Script Plugin for Elasticsearch](https://github.com/imotov/elasticsearch-native-script-example)  
> > > > [GitHub - imotov/elasticsearch-facet-script: Fully Scriptable Facets for ElasticSearch](https://github.com/imotov/elasticsearch-facet-script)
> > > > 
> > > > [Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog](https://bintray.com/imotov/elasticsearch-plugins/elasticsearch-native-script-example)
> > > > 
> > > > [http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html](http://mgranstrom.com/elasticsearch/2012/10/08/creating-a-native-script-for-elasticsearch.html)
> > > > 
> > > > That should help in your journey and good luck!
> > > > 
> > > > /Jason
> > > > 
> > > > On Fri, Dec 6, 2013 at 2:44 PM, Hanish Bansal \<  
> > > > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > > > 
> > > > > Thanks for response Jason !!
> > > > > 
> > > > > I gone through above links. My understanding is that we will have to  
> > > > > do below thing for this use case:
> > > > > 
> > > > > 1. Create a script in any supported lang. Write a custom  
> > > > > function(lets say in javascript lang) for reverse a string:
> > > > > 
> > > > > function reverse(s) {  
> > > > > return s.split('').reverse().join('');  
> > > > > }
> > > > > 
> > > > > create a script file for this "reverse.js"
> > > > > 
> > > > > 1. Put this script file into config/scripts
> > > > > 
> > > > > 2. I''ll also need to install javascript lang plugin to support  
> > > > > scripts written in javascript function.
> > > > > 
> > > > > 3. restart ES if i am using lower version than 0.90.6.
> > > > > 
> > > > > Using this i should be able to use custom function in my query.
> > > > > 
> > > > > Correct me i am missing anything.
> > > > > 
> > > > > Also i am not clear that how to use those functions in query. It would  
> > > > > be really helpful if you could put some examples for same.
> > > > > 
> > > > > On Thu, Dec 5, 2013 at 8:42 PM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:
> > > > > 
> > > > > > Hi Hanish,
> > > > > > 
> > > > > > Have you read on  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_preloaded_scripts)  
> > > > > > ?
> > > > > > 
> > > > > > It should be possible to change to other language other than mvel  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_default_scripting_language)
> > > > > > 
> > > > > > These are some supported scripts  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html#scripting)
> > > > > > 
> > > > > > HTH
> > > > > > 
> > > > > > /Jason
> > > > > > 
> > > > > > On Thu, Dec 5, 2013 at 9:14 PM, Hanish Bansal \<  
> > > > > > [hanish.bansal.agarwal@gmail.com](mailto:hanish.bansal.agarwal@gmail.com)\> wrote:
> > > > > > 
> > > > > > > Hi All,
> > > > > > > 
> > > > > > > I want to use some custom functions in elastic-search query.
> > > > > > > 
> > > > > > > I want to write my own function and use that while searching the  
> > > > > > > records in elastic-search.
> > > > > > > 
> > > > > > > for example:  
> > > > > > > i have a field "field1" having double value. Now i want to get all  
> > > > > > > records matching some conditions and also get cuberoot of field1 in each  
> > > > > > > record.
> > > > > > > 
> > > > > > > Logical query for same will look like:  
> > > > > > > select \*, cuberoot("field1") from index where condition1 and  
> > > > > > > condition2;
> > > > > > > 
> > > > > > > ## Other example:
> > > > > > > 
> > > > > > > i have a field "field2" having string value. Now i want to get all  
> > > > > > > records matching some conditions and also get reverse of field2 in each  
> > > > > > > record.
> > > > > > > 
> > > > > > > Logical query for same will look like:  
> > > > > > > select \*, reverse("field2") from index where condition1 and  
> > > > > > > condition2;
> > > > > > > 
> > > > > > > There are some inbuilt mvel functions as mention here[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_mvel\_built\_in\_functions](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_mvel_built_in_functions)that can be used within scripts. I want to use some custom function in  
> > > > > > > similar way of mvel inbuilt functions.
> > > > > > > 
> > > > > > > Is it possible to register some custom functions for query ?
> > > > > > > 
> > > > > > > Any suggestions would me really helpful.
> > > > > > > 
> > > > > > > --  
> > > > > > > _Thanks & Regards_  
> > > > > > > _Hanish Bansal_
> > > > > > > 
> > > > > > > --  
> > > > > > > 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).  
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8a3ALbcWgjMXjW9ffQNvggzjBs7nHJLRdvLSd6Btnr%3D5g%40mail.gmail.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).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itznCurPqz9Yv9%3Dtkqt0dKOCGELnZPV1g8fGEsPcAEt2jg%40mail.gmail.com)  
> > > > > > .  
> > > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > > > 
> > > > > --  
> > > > > _Thanks & Regards_  
> > > > > _Hanish Bansal_
> > > > > 
> > > > > --  
> > > > > 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).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4\_kYBZVyCyeGy1kt0gcjr2Y\_%2Bh0vqQsiAvFPGQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8YphAFh4_kYBZVyCyeGy1kt0gcjr2Y_%2Bh0vqQsiAvFPGQ%40mail.gmail.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).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX\_gbo4EPm\_hw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4ity%3Ds5AGpkA1TfiP9P45ssgRD4Dm9CujnWX_gbo4EPm_hw%40mail.gmail.com)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > _Thanks & Regards_  
> > > _Hanish Bansal_
> > > 
> > > --  
> > > 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).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC\_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8Yi%3D2kTBBprDC_euZBPrKHuUEhQpdmmKc9Smm6wVe%2Bj%2Bw%40mail.gmail.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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBQER0DUigqJv9yYr8vR7eUhj9wDQvAMnJoQzyUDz77dg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBQER0DUigqJv9yYr8vR7eUhj9wDQvAMnJoQzyUDz77dg%40mail.gmail.com)  
> > .
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> _Thanks & Regards_  
> _Hanish Bansal_
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAB0WE8aTV5MnHk\_tfoiwouwVjdqXOmtva1NXUkgebH9WMiZusQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAB0WE8aTV5MnHk_tfoiwouwVjdqXOmtva1NXUkgebH9WMiZusQ%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAD981\_Qr%3DBFeyEAFudSSioGCkRZBWfyoS1%2B3-wqS6A5A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAD981_Qr%3DBFeyEAFudSSioGCkRZBWfyoS1%2B3-wqS6A5A%40mail.gmail.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:01am UTC](https://discuss.elastic.co/t/custom-functions-for-query/14728/9 "2017-07-06T02:01:55Z")

</div>


