# How to get field name and data type by javascript

**URL:** <https://discuss.elastic.co/t/how-to-get-field-name-and-data-type-by-javascript/22596>\
**Category:** Elasticsearch\
**Created:** [March 10, 2015, 9:15am UTC](https://discuss.elastic.co/t/how-to-get-field-name-and-data-type-by-javascript/22596 "2015-03-10T09:15:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tao\_hiko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tao_hiko/32/707_2.png) [@tao\_hiko](https://discuss.elastic.co/u/tao_hiko)\
**Post date:** [March 10, 2015, 9:15am UTC](https://discuss.elastic.co/t/how-to-get-field-name-and-data-type-by-javascript/22596/1 "2015-03-10T09:15:39Z")

</div>

Hi All,

I need to get information of index/type by javascript and below is expected  
result

In ES by mapping command via Sense  
{  
"testindex": {  
"mappings": {  
"test": {  
"\_id": {  
"path": "anlz"  
},  
"properties": {  
"f1": {  
"type": "string"  
},  
"f2": {  
"type": "date"  
}  
}  
}  
}  
}  
}

and I need to get only field name and data type by javascript to list in  
front page as below

Column Name : f1  
Data Type : string  
Column Name : f2  
Data Type : date

Is it possible to get this? If yes, How to do?

Thanks  
Hiko

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4cacc4d5-adda-4940-b704-e870bd11fa10%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4cacc4d5-adda-4940-b704-e870bd11fa10%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:27am UTC](https://discuss.elastic.co/t/how-to-get-field-name-and-data-type-by-javascript/22596/2 "2017-07-06T00:27:39Z")

</div>


