_source_includes on a tree

Hello,
I have a document which contains a tree (of unknown depth) with a lot of information and i want to get only a subset of the data of each node (ex: only the key hello in the following example).

{
    "id": 42,
    "tree": [
        {
            "hello": "world",
            "children": [
                {
                    "hello": "europe",
                    "children": [
                        {
                            "hello": "france",
                            "children": []
                        }
                    ]
                }
            ]
        }
    ]
}

I have tried with _source_includes=tree.*hello / tree.*.hello (and a lot of other combination) but i get only the first level. Is there a way to perform an inclusion like this ?

Thanks for your support :slight_smile:

try

GET test/_search
{
  "_source": "**.hello"
}

I tested it unfortunately it didn't work, it returned some other keys not at all related to "hello" from the root document.

Also with tree.**.hello and tree.**hello etc, it didn't work.

Is there a place where i can find the documentation of those wildcard usage ? (the _source documentation only has simple use-cases)

I tested on 7.4.1 - can you try with the latest release as well?

Hum indeed i tested on an older version. I'll keep you updated once we have a 7.4.1 cluster.
I'm flagging this one as the solution and will re-open in case we still fail to get it.
Thank for your support.

1 Like

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