# How to insert data in index-pattern for field with 'Keyword' type using Index API

**URL:** <https://discuss.elastic.co/t/how-to-insert-data-in-index-pattern-for-field-with-keyword-type-using-index-api/261381>\
**Category:** Elasticsearch\
**Created:** [January 18, 2021, 5:58am UTC](https://discuss.elastic.co/t/how-to-insert-data-in-index-pattern-for-field-with-keyword-type-using-index-api/261381 "2021-01-18T05:58:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![savan.chovatiya](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@savan.chovatiya](https://discuss.elastic.co/u/savan.chovatiya)\
**Post date:** [January 18, 2021, 5:58am UTC](https://discuss.elastic.co/t/how-to-insert-data-in-index-pattern-for-field-with-keyword-type-using-index-api/261381/1 "2021-01-18T05:58:33Z")

</div>

Hello,

Index-pattern contains two fields like below.  
{"name":"aws\_region","type":"string","count":11,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":false},{"name":"aws\_region.keyword","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true}

When I insert data in the below way. It is throwing the following error.

{...  
"aws\_region": "demo data",  
...  
}

 ![Untitled1](https://us1.discourse-cdn.com/elastic/original/3X/a/9/a9e2e06d9340a71d4e8a6e38fe8de49ad9331771.png)

When I insert data in a nested dictionary then it won't throw an error but I am not able to see data in visualization with the query "aws\_region: EVENT1" even though I have added data with that.

{...  
"aws\_region": {  
"keyword": "demo data"  
},  
...}

---

<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:** [February 15, 2021, 6:01am UTC](https://discuss.elastic.co/t/how-to-insert-data-in-index-pattern-for-field-with-keyword-type-using-index-api/261381/2 "2021-02-15T06:01:14Z")

</div>

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