# Script filter (not dynamic)

**URL:** https://discuss.elastic.co/t/script-filter-not-dynamic/18479
**Category:** Elasticsearch
**Created:** [July 4, 2014, 8:43am UTC](https://discuss.elastic.co/t/script-filter-not-dynamic/18479 "2014-07-04T08:43:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Guillermo\_Arias\_del\_](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Guillermo\_Arias\_del\_](https://discuss.elastic.co/u/Guillermo_Arias_del_)
#### Post date: [July 4, 2014, 8:43am UTC](https://discuss.elastic.co/t/script-filter-not-dynamic/18479/1 "2014-07-04T08:43:04Z")

</div>

Hi, how can I specify a not dynamic script as a filter? The documentation  
shows how to specify a dynamic one:

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html#query-dsl-script-filter](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html#query-dsl-script-filter)

I would like to call a stored script, like in the example with the  
"calculate-score" function in:

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html)

--  
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/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 4, 2014, 8:55am UTC](https://discuss.elastic.co/t/script-filter-not-dynamic/18479/2 "2014-07-04T08:55:16Z")

</div>

Did you try this?

"filter" : {  
"script" : {  
"script" : "calculate-score"  
}  
}

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 4 juillet 2014 à 10:43:08, Guillermo Arias del Río ([ariasdelrio@gmail.com](mailto:ariasdelrio@gmail.com)) a écrit:

Hi, how can I specify a not dynamic script as a filter? The documentation shows how to specify a dynamic one:

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html#query-dsl-script-filter](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html#query-dsl-script-filter)

I would like to call a stored script, like in the example with the "calculate-score" function in:

## [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html)

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/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/etPan.53b66bf4.515f007c.2fae%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53b66bf4.515f007c.2fae%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Guillermo\_Arias\_del\_](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Guillermo\_Arias\_del\_](https://discuss.elastic.co/u/Guillermo_Arias_del_)
#### Post date: [July 4, 2014, 9:14am UTC](https://discuss.elastic.co/t/script-filter-not-dynamic/18479/3 "2014-07-04T09:14:01Z")

</div>

Oops, my script was not in the right place and was not found. I thought, ES  
was trying to evaluate the expression "" and I had to tell it  
that it was a script. Thanks.

El viernes, 4 de julio de 2014 10:55:30 UTC+2, David Pilato escribió:

> Did you try this?
> 
> "filter" : {  
> "script" : {  
> "script" : "calculate-score"  
> }  
> }
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 4 juillet 2014 à 10:43:08, Guillermo Arias del Río ([arias...@gmail.com](mailto:arias...@gmail.com)  
> \<javascript:\>) a écrit:
> 
> Hi, how can I specify a not dynamic script as a filter? The  
> documentation shows how to specify a dynamic one:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html#query-dsl-script-filter)
> 
> I would like to call a stored script, like in the example with the  
> "calculate-score" function in:
> 
> ## [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html)
> 
> 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:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/36585348-ba0e-4278-9b20-4c15906a8ef8%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/70d24648-f0bb-4f64-aa62-ccb833344662%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70d24648-f0bb-4f64-aa62-ccb833344662%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:17am UTC](https://discuss.elastic.co/t/script-filter-not-dynamic/18479/4 "2017-07-06T01:17:54Z")

</div>


