# Create URL scripted field to view surrounding documents (SOLVED)

**URL:** <https://discuss.elastic.co/t/create-url-scripted-field-to-view-surrounding-documents-solved/131396>\
**Category:** Kibana\
**Created:** [May 11, 2018, 5:39am UTC](https://discuss.elastic.co/t/create-url-scripted-field-to-view-surrounding-documents-solved/131396 "2018-05-11T05:39:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)\
**Post date:** [May 11, 2018, 5:39am UTC](https://discuss.elastic.co/t/create-url-scripted-field-to-view-surrounding-documents-solved/131396/1 "2018-05-11T05:39:11Z")

</div>

I'm trying to create a scripted field which is will be a URL to view the surrounding documents of the log.  
I've found that if I give the document id of the log. In the view surrounding logs link it brings the surrounding logs of the log of which the document id was given. I wanted to create a scripted field as a link on which you click and it redirects to the surrounding log link of that log.

I have created a link scripted field before too but mostly I have given static values in the input label for link. I was wondering is there any way I can send the document id of the log as a value to the link.

"[http://localhost:5601/app/kibana#/context/312de3f0-5281-11e8-8eb8-3bb6f14d4c1f/doc/](http://localhost:5601/app/kibana#/context/312de3f0-5281-11e8-8eb8-3bb6f14d4c1f/doc/) **wcO\_PmMBs1Vt6Gv23RVl**?\_a=(columns:!(\_source),filters:!(),predecessorCount:5,sort:!(logTimestamp,desc),successorCount:5)&\_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:'2018-04-30T19:00:00.000Z',mode:absolute,to:'2018-05-31T18:59:59.999Z'))"

document id = wcO\_PmMBs1Vt6Gv23RVl  
In the above url "wcO\_PmMBs1Vt6Gv23RVl" is the document Id.

Is there any way i can send the document id of the log (on which the scripted field is created) in the url.

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [May 11, 2018, 7:13pm UTC](https://discuss.elastic.co/t/create-url-scripted-field-to-view-surrounding-documents-solved/131396/2 "2018-05-11T19:13:36Z")

</div>

Does something like:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/c/1c2f85680a6bad626460d20723ca5a296052bf24.png)

work for you?

---

<div class="post-metadata">

**Author:** ![saramali](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@saramali](https://discuss.elastic.co/u/saramali)\
**Post date:** [May 14, 2018, 5:22am UTC](https://discuss.elastic.co/t/create-url-scripted-field-to-view-surrounding-documents-solved/131396/3 "2018-05-14T05:22:37Z")

</div>

Yes this worked. Thank you!

---

<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 11, 2018, 5:34am UTC](https://discuss.elastic.co/t/create-url-scripted-field-to-view-surrounding-documents-solved/131396/4 "2018-06-11T05:34:27Z")

</div>

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