# Type of Keyword can support and maintain type e.g boolean, number

**URL:** <https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806>\
**Category:** Elasticsearch\
**Created:** [June 6, 2018, 12:42pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806 "2018-06-06T12:42:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![delk13](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@delk13](https://discuss.elastic.co/u/delk13)\
**Post date:** [June 6, 2018, 12:42pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806/1 "2018-06-06T12:42:21Z")

</div>

Hello,

I have an field (name of field "value") type of text

I noticed that when I put (insert) into that indexer a boolean type  
e.g {"value" : true} or {"value" : 17} then the indexer keeps the type and returns me the json (document) with the type i put it in previously. same for an array e.g {"value": [12,13,14]}

Is that behaviour anywhere documented ? does E.S keep the json type somewhere internally and while it store the document as string (text), over serialization it sends it over with the correct json input type

index definition:

{  
"configuration": {  
"dynamic": "strict",  
"\_all": {  
"enabled": true  
},  
"properties": {  
"key": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"value": {  
"type": "text",  
"norms": false,  
"fields": {  
"raw": {  
"type": "keyword",  
"doc\_values": false  
}  
}  
}  
}  
}  
}

Appreciate your input here

---

<div class="post-metadata">

**Author:** ![tdasch](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@tdasch](https://discuss.elastic.co/u/tdasch)\
**Post date:** [June 6, 2018, 12:55pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806/2 "2018-06-06T12:55:33Z")

</div>

Hey Delk13,

Could you possibly show your mapping and an example of your input and what is returned?

Thanks!

---

<div class="post-metadata">

**Author:** ![delk13](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@delk13](https://discuss.elastic.co/u/delk13)\
**Post date:** [June 6, 2018, 1:10pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806/3 "2018-06-06T13:10:30Z")

</div>

Input examples could be:

PUT my\_index/1

{  
"key" : "vasilis.key2",  
"value" : [2,3,4]  
}

or

{  
"key" : "cw.vasilis.key2",  
"value" : true  
}

Those operations succeed and when I get back the documents (e.g using search api) the value json field is returned with the type I put it in

---

<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:** [June 6, 2018, 1:19pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806/4 "2018-06-06T13:19:04Z")

</div>

What's the actual mapping though.

---

<div class="post-metadata">

**Author:** ![delk13](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@delk13](https://discuss.elastic.co/u/delk13)\
**Post date:** [June 6, 2018, 1:29pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806/5 "2018-06-06T13:29:24Z")

</div>

look at the definition of mapper.

the type of the field "value" is TEXT

---

<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:** [June 6, 2018, 3:48pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806/6 "2018-06-06T15:48:54Z")

</div>

Then that is what it's being stored and returned as. There's nothing else happening here.

---

<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:** [July 4, 2018, 3:48pm UTC](https://discuss.elastic.co/t/type-of-keyword-can-support-and-maintain-type-e-g-boolean-number/134806/7 "2018-07-04T15:48:59Z")

</div>

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