# Get document index pattern ID in scripted field

**URL:** <https://discuss.elastic.co/t/get-document-index-pattern-id-in-scripted-field/122678>\
**Category:** Kibana\
**Created:** [March 6, 2018, 9:06am UTC](https://discuss.elastic.co/t/get-document-index-pattern-id-in-scripted-field/122678 "2018-03-06T09:06:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![isharamet](https://avatars.discourse-cdn.com/v4/letter/i/848f3c/32.png) [@isharamet](https://discuss.elastic.co/u/isharamet)\
**Post date:** [March 6, 2018, 9:06am UTC](https://discuss.elastic.co/t/get-document-index-pattern-id-in-scripted-field/122678/1 "2018-03-06T09:06:52Z")

</div>

Hello,

Is it possible to somehow get current index pattern ID from scripted field?.

Thanks,  
Ivan

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [March 7, 2018, 5:10pm UTC](https://discuss.elastic.co/t/get-document-index-pattern-id-in-scripted-field/122678/2 "2018-03-07T17:10:06Z")

</div>

Hi,  
No, you can't get the document index pattern ID in the scripted field, You will only have access available to the document in a scripted field, the index pattern id is likely saved in a different index  
You need to query first in order to get hold of index pattern id. You can maybe file an Enhancement request for templated scripted fields, but that'll be difficult to do securely and end up being closed, but it will open up a discussion around it .

> **[Build software better, together](https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Felastic%2Fkibana%2Fissues%2Fnew)**
>
> GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 80 million projects.

  
Thanks  
Rashmi

---

<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:** [April 4, 2018, 5:10pm UTC](https://discuss.elastic.co/t/get-document-index-pattern-id-in-scripted-field/122678/3 "2018-04-04T17:10:08Z")

</div>

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