# Searching through a document not knowing the path

**URL:** <https://discuss.elastic.co/t/searching-through-a-document-not-knowing-the-path/323132>\
**Category:** Elasticsearch\
**Created:** [January 13, 2023, 1:13pm UTC](https://discuss.elastic.co/t/searching-through-a-document-not-knowing-the-path/323132 "2023-01-13T13:13:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polala](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Polala](https://discuss.elastic.co/u/Polala)\
**Post date:** [January 13, 2023, 1:13pm UTC](https://discuss.elastic.co/t/searching-through-a-document-not-knowing-the-path/323132/1 "2023-01-13T13:13:00Z")

</div>

I want to search through a document and get data for Steven and all his children (so in this example James). Is there a way to do it not knowing the path for Steven - so it should be children.children.name - but what if I don't know on which level Steven occurs? Is it even possible in Elasticsearch?

```auto
{
    name: "John",
    a: 1,
    b: 2,
    children:
        [
            {
                name: Mark,
                a: 3,
                b: 5,
                children:
                    [
                        {
                            name: "Steven",
                            a: 2,
                            b: 5,
                            children: [{ name: "James", a: 1, b: 5 }],
                        },
                    ],
            },
            { name: "David", a: 3, b: 5 }
        ],
}

```

---

<div class="post-metadata">

**Author:** ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)\
**Post date:** [January 13, 2023, 1:55pm UTC](https://discuss.elastic.co/t/searching-through-a-document-not-knowing-the-path/323132/2 "2023-01-13T13:55:56Z")

</div>

What is the data type of your field: is it nested or object ?

---

<div class="post-metadata">

**Author:** ![Polala](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Polala](https://discuss.elastic.co/u/Polala)\
**Post date:** [January 13, 2023, 1:59pm UTC](https://discuss.elastic.co/t/searching-through-a-document-not-knowing-the-path/323132/3 "2023-01-13T13:59:03Z")

</div>

We're just working on design, but were planning to make it nested.

---

<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:** [February 10, 2023, 1:59pm UTC](https://discuss.elastic.co/t/searching-through-a-document-not-knowing-the-path/323132/4 "2023-02-10T13:59:24Z")

</div>

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