API version: 0.3.0

---

# Find nested elements

This example uses a **variable length path** (`[:IS_MEMBER_OF*..]`) to find every `Plant` that is a member of the
taxon "Liliales", directly or through any number of intermediate taxonomic ranks, and limits the result to `5` matches
using Cypher's own `LIMIT` clause.\
Results are then [hydrated](/reference/search/element-hydration.md), i.e. transformed into a collection response.

```bash
curl -X POST \
  -H 'Authorization: Bearer secret-token:PIPeJGUt7c00ENn8a5uDlc' \
  -H 'Content-Type: application/json' \
  -d '{
        "debug": true,
        "steps": [
          {
            "type": "cypher-path-subset",
            "query": "MATCH path=((:Plant)-[:IS_MEMBER_OF*..]->(:Taxon {name: \"Liliales\"})) RETURN path LIMIT 5"
          },
          {
            "type": "element-hydration"
          }
        ]
      }' \
  https://api.example.com/search
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "IS_MEMBER_OF",
      "id": "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf",
      "start": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
      "end": "02IiNr0GOoKiPMMYRIBtxoQ2Nx3g0G3igcbuW",
      "data": {
        "scenario": "general.botanicExample",
        "createdAt": "2026-12-03T12:05:47+00:00",
        "updatedAt": "2026-12-03T12:05:47+00:00"
      }
    },
    {
      "type": "Taxon",
      "id": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
      "data": {
        "name": "Gloriosa",
        "path": "/Plantae/Tracheophytes/Angiosperms/Monocots/Liliales/Colchicaceae/Gloriosa",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Gloriosa_(plant)",
        "description": "Gloriosa is a genus of 12 species in the plant family Colchicaceae, and includes the formerly recogn...",
        "createdAt": "2026-12-03T12:05:24+00:00",
        "updatedAt": "2026-12-03T12:05:24+00:00"
      }
    },
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMLO9dQSP9Mmvy5E3YmZXDsBP",
      "data": {
        "images": [
          {
            "description": "Lilium candidum, Israel",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/c/cc/ShoshanTzachor-2-wiki-Zachi-Evenor.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/ShoshanTzachor-2-wiki-Zachi-Evenor.jpg/500...",
            "link": "https://en.wikipedia.org/wiki/File:ShoshanTzachor-2-wiki-Zachi-Evenor.jpg"
          },
          {
            "description": "Photo of Lilium candidum at VanDusen Botanical Garden",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/3/30/Lilium_candidum_1.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Lilium_candidum_1.jpg/960px-Lilium_candidu...",
            "link": "https://en.wikipedia.org/wiki/File:Lilium_candidum_1.jpg"
          }
        ],
        "hasFile": true,
        "name": "Lily",
        "scientificName": "L. candidum",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Lilium_candidum",
        "description": "Lilium candidum, the Madonna lily or white lily, is a plant in the true lily family. It is native to...",
        "createdAt": "2026-12-03T12:05:26+00:00",
        "updatedAt": "2026-12-03T12:05:26+00:00"
      },
      "file": {
        "contentLength": 115168,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "ee066b93ae72c719f863a428f03c86ecd28e52818528eacf4d4e32acb4b4b37c"
        }
      }
    },
    "... 22 more items omitted (shapes seen: type:IS_MEMBER_OF, type:Taxon, type:Plant) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "cypher-path-subset",
        "query": "MATCH path=((:Plant)-[:IS_MEMBER_OF*..]->(:Taxon {name: \"Liliales\"})) RETURN path LIMIT 5",
        "parameters": {
          "stepResults": []
        }
      },
      "step-handler": "cypher-path-subset (App\\EventSystem\\SearchStep\\EventListener\\CypherPathSearchStepEventListener)",
      "start": 1796299630.548187,
      "end": 1796299631.201742,
      "duration": 0.6535549163818359
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "paths": [
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                    "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
                    "02IiNr0GOoKiPMMYRIBtxoQ2Nx3g0G3igcbuW",
                    "02IiNr0GOoKiPMLInXm7QkEoxFbe837GDR9EV"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMZVLUkwbKeM2UFyiSIJvEuY",
                    "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf",
                    "02IiNr0GOoKiPMLgu4qdyIrJEVzhM69wTc2v5"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7",
                    "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
                    "02IiNr0GOoKiPMM8VYQwSjn1SLUX4EI5n8arM",
                    "... 2 more items omitted (shapes seen: string) ..."
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMyuvn1d0GVsjZEiuAmCjMbX",
                    "02IiNr0GOoKiPMM86yItmK1SnILVxwBzhbhYk",
                    "02IiNr0GOoKiPMMXaOce9uITnnmfKj8YfGZM0",
                    "02IiNr0GOoKiPMMKrgBEX6rIOu4OTtq2FOHoj"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMLzlyajuxj3r003A91sQN0s8",
                    "02IiNr0GOoKiPMMKHq1FVE9PGfXYUHKPwwRDT",
                    "02IiNr0GOoKiPMLUhPgw5CO4vUzsV8MHdnfaG",
                    "02IiNr0GOoKiPMLInXm7QkEoxFbe837GDR9EV"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMwMNjkoGBnRQLJeWhcxa3ZQ",
                    "02IiNr0GOoKiPMLAL1VrGtB6WIh8flYYbCPqq",
                    "02IiNr0GOoKiPMMz85gIXjECJuxOKCky58rKp"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMLO9dQSP9Mmvy5E3YmZXDsBP",
                    "02IiNr0GOoKiPMM6DzjFe3koFBcuei8dqj4Vv",
                    "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
                    "... 3 more items omitted (shapes seen: string) ..."
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMvXWHdHAd6zAuHMdG38K6H6",
                    "02IiNr0GOoKiPMM3SGvVxxgH5Kslh8aDjg14C",
                    "02IiNr0GOoKiPMM86yItmK1SnILVxwBzhbhYk",
                    "... 2 more items omitted (shapes seen: string) ..."
                  ]
                }
              ]
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1796299631.202049,
      "element-hydration:redundantElementIds": {
        "message": "Removed 9 redundant elementIds.",
        "removedElementIds": [
          "02IiNr0GOoKiPMLInXm7QkEoxFbe837GDR9EV",
          "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
          "02IiNr0GOoKiPMLdFaNMOFkRwUaBIeqDCV8MK",
          "... 4 more items omitted (shapes seen: string) ..."
        ]
      },
      "accessibleElementIds": [
        "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf",
        "02IiNr0GOoKiPMLAL1VrGtB6WIh8flYYbCPqq",
        "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
        "... 22 more items omitted (shapes seen: string) ..."
      ],
      "end": 1796299631.295099,
      "duration": 0.09305
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: Authorization, Content-Type, Prefer
Access-Control-Allow-Methods: OPTIONS, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Preference-Applied
Allow: OPTIONS, POST
Cache-Control: no-cache, private
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Dec 2026 12:24:47 GMT
Transfer-Encoding: chunked
Vary: Prefer, Accept-Encoding
X-Powered-By: Ember Nexus API
```

Because the path length is unbounded, the resulting graph includes every intermediate taxon between each matching
plant and "Liliales" - not just the plants and the root taxon themselves.

**Note**: `LIMIT` restricts how many _paths_ Cypher returns, which is not the same as `pageSize` on the Elasticsearch
query step - Cypher path query does not currently support pagination parameters of its own.

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)

Previous: [Find tagged elements](/reference/search/cypher-path-subset/find-tagged-elements.md)

Next: [Parameterized cypher search](/reference/search/cypher-path-subset/parameterized-cypher-search.md)
