# scriptFilter with indexed scripts using JavaApi 1.6/1.7

**URL:** <https://discuss.elastic.co/t/scriptfilter-with-indexed-scripts-using-javaapi-1-6-1-7/36975>\
**Category:** Elasticsearch\
**Created:** [December 11, 2015, 12:04pm UTC](https://discuss.elastic.co/t/scriptfilter-with-indexed-scripts-using-javaapi-1-6-1-7/36975 "2015-12-11T12:04:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eliran\_Moyal](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@Eliran\_Moyal](https://discuss.elastic.co/u/Eliran_Moyal)\
**Post date:** [December 11, 2015, 12:04pm UTC](https://discuss.elastic.co/t/scriptfilter-with-indexed-scripts-using-javaapi-1-6-1-7/36975/1 "2015-12-11T12:04:21Z")

</div>

Hey  
I'm using the JavaApi to query elasticsearch  
I'm using the ScriptFilterBuilder to create the query, but it doesn't have an option for pre-indexed scripts or I can't find it...  
it only create a "script" field but i need "script\_id" in order to run the "hour\_between" script.

> "filter": {  
> "script": {  
> "script": "hour\_between",  
> "lang": "groovy",  
> "params": {  
> "field": "insert\_time",  
> "start": 16,  
> "end": 17  
> }  
> }  
> }

what i need is

> "filter": {  
> "script": {  
> "script\_id": "hour\_between",  
> "lang": "groovy",  
> "params": {  
> "field": "insert\_time",  
> "start": 16,  
> "end": 17  
> }  
> }  
> }

Any way of doing this on JavaApi?  
Thanks,  
Eliran

---

<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 5, 2017, 11:31pm UTC](https://discuss.elastic.co/t/scriptfilter-with-indexed-scripts-using-javaapi-1-6-1-7/36975/2 "2017-07-05T23:31:48Z")

</div>


