# Suggest index design for my data

**URL:** <https://discuss.elastic.co/t/suggest-index-design-for-my-data/301702>\
**Category:** Elasticsearch\
**Created:** [April 6, 2022, 6:08am UTC](https://discuss.elastic.co/t/suggest-index-design-for-my-data/301702 "2022-04-06T06:08:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martynas\_Juravicius](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/martynas_juravicius/32/99690_2.png) [@Martynas\_Juravicius](https://discuss.elastic.co/u/Martynas_Juravicius)\
**Post date:** [April 6, 2022, 6:08am UTC](https://discuss.elastic.co/t/suggest-index-design-for-my-data/301702/1 "2022-04-06T06:08:18Z")

</div>

Hey, everyone,

We are currently building some search engine for our internal data and we are using Elasticsearch for that. **Our data looks like this:**

- Object A: {attribute\_a\_1, attribute\_a\_2} - 100M of object A;
- Object B: {attribute\_b\_1, attribute\_b\_2} - 200M of object B;
- Object C: {attribute\_c\_1, attribute\_c\_2} - 50M of object C.

**Now the relationships are:**

- Each of object A can have none or one or many objects B;
- Each of object A can have none or one or many objects C.

**My goal is to have index which can be really fast searched for:**

- Objects A - by using its own and other objects attributes;
- Objects B - by using its own and other objects attributes.

**Example:**

Find all objects B where attribute\_a\_1="something", attribute\_b\_2="something", attribute\_c\_1="something".

**Currently we are using nested structures:**

```auto
PUT object_a
{
	"mapping": {
		"properties": {
			"attribute_a_1": {...},
			"attribute_a_2": {...},
			"object_b": {
				"type": "nested",
				"properties": {
					"attribute_b_1": {...},
					"attribute_b_2": {...}
				}
			},
			"object_c": {
				"type": "nested",
				"properties": {
					"attribute_c_1": {...},
					"attribute_c_2": {...}
				}
			}
		}
	}
}

```

Performance isn't bad, but having some objects A, which contains hundreds of thousands of objects B and object C, really slow down the querying. We know that this design costs a lot of resources to update data, but we don't do often updates, so this is not a problem. Any suggestions how can we improve our index design? Maybe we are thinking all wrong. I would really appreciate any suggestions. Thank you in advance 🙂

---

<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:** [April 6, 2022, 2:20pm UTC](https://discuss.elastic.co/t/suggest-index-design-for-my-data/301702/2 "2022-04-06T14:20:52Z")

</div>

If you need to have all the attributes of object B inside A, some documents are going to be huge.

I would probably separate each object type into different indices, and reference the common attributes between them. I would use a key to search for attributes in all indices.

---

<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:** [May 4, 2022, 2:21pm UTC](https://discuss.elastic.co/t/suggest-index-design-for-my-data/301702/3 "2022-05-04T14:21:43Z")

</div>

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