# Create scrpit to add field calling API

**URL:** <https://discuss.elastic.co/t/create-scrpit-to-add-field-calling-api/303921>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [May 4, 2022, 9:23am UTC](https://discuss.elastic.co/t/create-scrpit-to-add-field-calling-api/303921 "2022-05-04T09:23:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wdffw](https://avatars.discourse-cdn.com/v4/letter/w/7993a0/32.png) [@wdffw](https://discuss.elastic.co/u/wdffw)\
**Post date:** [May 4, 2022, 9:23am UTC](https://discuss.elastic.co/t/create-scrpit-to-add-field-calling-api/303921/1 "2022-05-04T09:23:47Z")

</div>

Hello,  
I wand a add a field by a painless (or another scripting language) to call an API data and show the result in the field by emit for example ???

To be more clearly exactly, for example i have an API [http://xxx.xxx.xxx.xxx](http://xxx.xxx.xxx.xxx):yyy?v1=x1&v2=x2&ip=ip1 where ip1 can be retrieve by doc["ipadd.keyword'].value.  
Example :

```auto
def s = doc['src.keyword'].value;
def v = http://xxx.xxx.xxx.xxx:yyy?v1=x1&v2=x2&ip=s;
if (v ){
    return emit("True");
}
else {
	emit("False");
}

```

The task is very important for us and i need your help for this if someone directed me to the right path please.

Thanks for the support

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 10, 2022, 6:43am UTC](https://discuss.elastic.co/t/create-scrpit-to-add-field-calling-api/303921/2 "2022-05-10T06:43:47Z")

</div>

You want painless to call an external URL? That's not possible as it's a security risk.

---

<div class="post-metadata">

**Author:** ![wdffw](https://avatars.discourse-cdn.com/v4/letter/w/7993a0/32.png) [@wdffw](https://discuss.elastic.co/u/wdffw)\
**Post date:** [May 10, 2022, 10:11am UTC](https://discuss.elastic.co/t/create-scrpit-to-add-field-calling-api/303921/3 "2022-05-10T10:11:35Z")

</div>

Hello @warkolm thanks for your response,

Is there any other way to do what I want to do without using painless but another kibana script or even with the http filter ???

---

<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:** [June 7, 2022, 10:12am UTC](https://discuss.elastic.co/t/create-scrpit-to-add-field-calling-api/303921/4 "2022-06-07T10:12:28Z")

</div>

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