# How to Structure Our Data

**URL:** <https://discuss.elastic.co/t/how-to-structure-our-data/62952>\
**Category:** Elasticsearch\
**Created:** [October 13, 2016, 1:50pm UTC](https://discuss.elastic.co/t/how-to-structure-our-data/62952 "2016-10-13T13:50:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ols](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@ols](https://discuss.elastic.co/u/ols)\
**Post date:** [October 13, 2016, 1:50pm UTC](https://discuss.elastic.co/t/how-to-structure-our-data/62952/1 "2016-10-13T13:50:37Z")

</div>

I'm trying to work out if we should structure our data under one index or if we need multiple indexes.

If you take the Blog / Comments example. If comments are stored as children of the Blog post (in a nested array) then we can easily do things like filter Blogs based on comments, but can we efficiently query all comments over time? Can we also run aggregations on comments to get, say, all comments grouped by month?

---

<div class="post-metadata">

**Author:** ![ols](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@ols](https://discuss.elastic.co/u/ols)\
**Post date:** [October 13, 2016, 5:59pm UTC](https://discuss.elastic.co/t/how-to-structure-our-data/62952/2 "2016-10-13T17:59:33Z")

</div>

Answering my own question: I should use the [parent/child](https://www.elastic.co/guide/en/elasticsearch/guide/master/parent-child.html) relationship. I can filter both ways but items are indexed separately.

---

<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 5, 2017, 10:12pm UTC](https://discuss.elastic.co/t/how-to-structure-our-data/62952/3 "2017-07-05T22:12:35Z")

</div>


