# Don't import duplicates in nested objects

**URL:** <https://discuss.elastic.co/t/dont-import-duplicates-in-nested-objects/288952>\
**Category:** Elasticsearch\
**Created:** [November 11, 2021, 6:27am UTC](https://discuss.elastic.co/t/dont-import-duplicates-in-nested-objects/288952 "2021-11-11T06:27:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lazaro\_O\_Farrill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lazaro_o_farrill/32/96993_2.png) [@Lazaro\_O\_Farrill](https://discuss.elastic.co/u/Lazaro_O_Farrill)\
**Post date:** [November 11, 2021, 6:27am UTC](https://discuss.elastic.co/t/dont-import-duplicates-in-nested-objects/288952/1 "2021-11-11T06:27:56Z")

</div>

Trying to index a SQL database for a eCommerce. It is divided by store where each store has it's own products. I'm trying to create a schema with the following structure.

```auto
{
    name: "store1",
    products: [{name: "product1", price: "1"},...]

}

```

The problem I'm having is that I haven't found a way to avoid duplicate products when storing them as nested objects. Is this possible or is this approach just wrong.

---

<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:** [December 9, 2021, 6:28am UTC](https://discuss.elastic.co/t/dont-import-duplicates-in-nested-objects/288952/2 "2021-12-09T06:28:38Z")

</div>

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