# Passing location (geopoint) to stored scripts from java

**URL:** <https://discuss.elastic.co/t/passing-location-geopoint-to-stored-scripts-from-java/284297>\
**Category:** Elasticsearch\
**Created:** [September 15, 2021, 2:39pm UTC](https://discuss.elastic.co/t/passing-location-geopoint-to-stored-scripts-from-java/284297 "2021-09-15T14:39:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madhu\_Dasa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/madhu_dasa/32/84014_2.png) [@Madhu\_Dasa](https://discuss.elastic.co/u/Madhu_Dasa)\
**Post date:** [September 15, 2021, 2:39pm UTC](https://discuss.elastic.co/t/passing-location-geopoint-to-stored-scripts-from-java/284297/1 "2021-09-15T14:39:59Z")

</div>

I have a field "location : {"type":"geopoint"} in ES mapping. I wrote a script to get documents based on location. But how do I pass values to this field from Java?  
I used below way, but seems not working

GeoPoint location = new GeoPoint(\<\>,\<\>);  
scriptParams.put("location", location);

I get below error:

{"type":"action\_request\_validation\_exception","reason":"Validation Failed: 1: no requests added;"}

Any help on this would be appreciated.

Thanks & Regards,  
Madhu

---

<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:** [October 13, 2021, 2:40pm UTC](https://discuss.elastic.co/t/passing-location-geopoint-to-stored-scripts-from-java/284297/2 "2021-10-13T14:40:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
