# Passing parameters to preloaded scripts

**URL:** <https://discuss.elastic.co/t/passing-parameters-to-preloaded-scripts/9940>\
**Category:** Elasticsearch\
**Created:** [December 4, 2012, 11:42pm UTC](https://discuss.elastic.co/t/passing-parameters-to-preloaded-scripts/9940 "2012-12-04T23:42:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![movelikethewind](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/movelikethewind/32/2591_2.png) [@movelikethewind](https://discuss.elastic.co/u/movelikethewind)\
**Post date:** [December 4, 2012, 11:42pm UTC](https://discuss.elastic.co/t/passing-parameters-to-preloaded-scripts/9940/1 "2012-12-04T23:42:52Z")

</div>

I'm trying to use a preloaded javascript file stored in /config/scripts/test.js

[http://www.elasticsearch.org/guide/reference/query-dsl/custom-score-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/custom-score-query.html)

I'm using the Tire gem for Rails integration.

query do  
custom\_score :params =\> {😛 =\> 5}, :script =\> "test", :lang =\> "js" do string '\* end end

If I use an inline script expression, I can access the parameter p very easily. How do I pass it to the preloaded script test.js?

Thanks!  
George

---

<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:01am UTC](https://discuss.elastic.co/t/passing-parameters-to-preloaded-scripts/9940/2 "2017-07-06T03:01:29Z")

</div>

Closed on July 6, 2017, 3:01am UTC


