# Get a mapping/schema of flattened field

**URL:** <https://discuss.elastic.co/t/get-a-mapping-schema-of-flattened-field/315919>\
**Category:** Elasticsearch\
**Created:** [October 5, 2022, 11:59pm UTC](https://discuss.elastic.co/t/get-a-mapping-schema-of-flattened-field/315919 "2022-10-05T23:59:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![getorca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/getorca/32/42269_2.png) [@getorca](https://discuss.elastic.co/u/getorca)\
**Post date:** [October 5, 2022, 11:59pm UTC](https://discuss.elastic.co/t/get-a-mapping-schema-of-flattened-field/315919/1 "2022-10-05T23:59:31Z")

</div>

Is there a way to get a mapping or schema of all the sub-fields that exist in my flattened field?

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [October 6, 2022, 3:07am UTC](https://discuss.elastic.co/t/get-a-mapping-schema-of-flattened-field/315919/2 "2022-10-06T03:07:07Z")

</div>

Hi @getorca

By documentation, is not possible.

> The `flattened` type provides an alternative approach, where the entire object is mapped as a single field.

---

<div class="post-metadata">

**Author:** ![getorca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/getorca/32/42269_2.png) [@getorca](https://discuss.elastic.co/u/getorca)\
**Post date:** [October 6, 2022, 4:10am UTC](https://discuss.elastic.co/t/get-a-mapping-schema-of-flattened-field/315919/3 "2022-10-06T04:10:46Z")

</div>

I'm wondering about with painless even. The subfields exist in the flattened field in some format, you can query on them. However not sure where to begin with painless. I guess it would be a loop on the field but not sure how to unpack it. Also not sure if painless can support recursion.

I guess I can probably do it in my app code taking a sampling of the docs.

---

<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:** [November 3, 2022, 4:11am UTC](https://discuss.elastic.co/t/get-a-mapping-schema-of-flattened-field/315919/4 "2022-11-03T04:11:43Z")

</div>

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