# Storing data in Nested type vs Storing directly in outer layer

**URL:** <https://discuss.elastic.co/t/storing-data-in-nested-type-vs-storing-directly-in-outer-layer/202805>\
**Category:** Elasticsearch\
**Created:** [October 9, 2019, 9:45am UTC](https://discuss.elastic.co/t/storing-data-in-nested-type-vs-storing-directly-in-outer-layer/202805 "2019-10-09T09:45:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakmo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakmo/32/55441_2.png) [@rakmo](https://discuss.elastic.co/u/rakmo)\
**Post date:** [October 9, 2019, 9:45am UTC](https://discuss.elastic.co/t/storing-data-in-nested-type-vs-storing-directly-in-outer-layer/202805/1 "2019-10-09T09:45:37Z")

</div>

I have a 100 fields to be stored, whose structure is defined. Which structure is preferred of these both?

```
// Mapping 1

{
    "data": "nested"
}

// Sample Data Structure 1

{
    "data": {
        "f1": "value",
        "f2": ["value1", "value2"]
        .
        .
        .
        .
        "f100": 123
    }
}

// Mapping 2

{
    "f1": "keyword",
    "f2": "keyword",
    .
    .
    .
    .
    "f100": "integer"
}

// Sample Data Structure 2

{
    "f1": "value",
    "f2": ["value1", "value2"]
    .
    .
    .
    .
    "f100": 123
}

```

What are the benefits of each of these structures? Also need to know the pros and cons of each of these on large scale 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:** [November 6, 2019, 9:45am UTC](https://discuss.elastic.co/t/storing-data-in-nested-type-vs-storing-directly-in-outer-layer/202805/2 "2019-11-06T09:45:47Z")

</div>

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