# How to list out / export all the fields along with data types

**URL:** <https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975>\
**Category:** Elasticsearch\
**Created:** [February 20, 2023, 12:44pm UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975 "2023-02-20T12:44:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RajuParipelly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajuparipelly/32/117473_2.png) [@RajuParipelly](https://discuss.elastic.co/u/RajuParipelly)\
**Post date:** [February 20, 2023, 12:44pm UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/1 "2023-02-20T12:44:10Z")

</div>

I have an index with 25000 fields and wanted to export all the fields into a csv file along with data type? is there any way to do this?

---

<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:** [February 21, 2023, 2:59am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/2 "2023-02-21T02:59:39Z")

</div>

You can `GET indexname/_mapping` and then feed it into something like `jq` to do that, but there's nothing native to provide a CSV output like that.

---

<div class="post-metadata">

**Author:** ![RajuParipelly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajuparipelly/32/117473_2.png) [@RajuParipelly](https://discuss.elastic.co/u/RajuParipelly)\
**Post date:** [February 21, 2023, 4:39am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/3 "2023-02-21T04:39:09Z")

</div>

Since I have more than 25000 fields GET indexname/\_mapping is not returning result ..

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 21, 2023, 5:15am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/4 "2023-02-21T05:15:25Z")

</div>

Which version of Elasticsearch are you using?

Why do you have so many fields?

How many indices do you have in the cluster? How many of these do have very large number of fields?

---

<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:** [February 21, 2023, 5:28am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/5 "2023-02-21T05:28:00Z")

</div>

What is the output from the [`_cluster/stats?pretty&human` API](https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-stats.html)?

---

<div class="post-metadata">

**Author:** ![RajuParipelly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajuparipelly/32/117473_2.png) [@RajuParipelly](https://discuss.elastic.co/u/RajuParipelly)\
**Post date:** [February 21, 2023, 6:09am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/6 "2023-02-21T06:09:27Z")

</div>

Elasticsearch version we are using is 8.4.2  
Different services are logging into one index, hence ended up with 25k fields.. now we wanted to do some analysis on the fields and data types, hence wanted to get all the fields and data types

we have 350 plus indices and around 80 to 100 fields have large number of fields

---

<div class="post-metadata">

**Author:** ![RajuParipelly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajuparipelly/32/117473_2.png) [@RajuParipelly](https://discuss.elastic.co/u/RajuParipelly)\
**Post date:** [February 21, 2023, 6:09am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/7 "2023-02-21T06:09:59Z")

</div>

I am unable to copy it from my server, since it is in RDP we don't have anyway to copy the output of the API

---

<div class="post-metadata">

**Author:** ![RajuParipelly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajuparipelly/32/117473_2.png) [@RajuParipelly](https://discuss.elastic.co/u/RajuParipelly)\
**Post date:** [February 28, 2023, 10:20am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/8 "2023-02-28T10:20:19Z")

</div>

The below link helped me to retrieve all the fields

> **[SHOW COLUMNS | Elasticsearch Guide \[8.6\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-syntax-show-columns.html)**

---

<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:** [March 28, 2023, 10:20am UTC](https://discuss.elastic.co/t/how-to-list-out-export-all-the-fields-along-with-data-types/325975/9 "2023-03-28T10:20:34Z")

</div>

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