# Getting "no field found in the mapping" when creating a scripted field

**URL:** <https://discuss.elastic.co/t/getting-no-field-found-in-the-mapping-when-creating-a-scripted-field/341684>\
**Category:** Elastic Agent\
**Created:** [August 25, 2023, 11:45am UTC](https://discuss.elastic.co/t/getting-no-field-found-in-the-mapping-when-creating-a-scripted-field/341684 "2023-08-25T11:45:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr\_ph](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@mr\_ph](https://discuss.elastic.co/u/mr_ph)\
**Post date:** [August 25, 2023, 11:45am UTC](https://discuss.elastic.co/t/getting-no-field-found-in-the-mapping-when-creating-a-scripted-field/341684/1 "2023-08-25T11:45:15Z")

</div>

Hi team,  
I am using FortiGate integration in my ELK. So I need to create a new scripted fields for more visibility into that logs. Created a scripted field with the following condition.

`if ( doc['fortinet.firewall.action'].value == "Add" && doc['fortinet.firewall.cfgpath'].value == "system.admin" ) { def new_field = doc.['fortinet.firewall.cfgobj'].value; }`

after creating this field, the getting the error no field found in the mapping.

Added these fields into the component template mapping and also added in the index template.

Still it showing that "no field found in the mapping".  
Is the script have any error or any error in the mapping in the templates. Double checked the field name and data types.  
The index pattern is managed by fleet.

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:** [September 22, 2023, 11:45am UTC](https://discuss.elastic.co/t/getting-no-field-found-in-the-mapping-when-creating-a-scripted-field/341684/2 "2023-09-22T11:45:44Z")

</div>

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