API version: dev

---

# 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": "024e049b-219a-477c-9b8c-be1244c16dab",
      "start": "16884ac8-ba7a-4c91-8449-4fdd803644b6",
      "end": "b7cda919-deea-49f9-9151-49132f83cbff",
      "data": {
        "created": "2025-09-25T18:43:24+00:00",
        "updated": "2025-09-25T18:43:24+00:00",
        "scenario": "general.botanicExample"
      }
    },
    {
      "type": "Taxon",
      "id": "16884ac8-ba7a-4c91-8449-4fdd803644b6",
      "data": {
        "created": "2025-09-25T18:43:12+00:00",
        "updated": "2025-09-25T18:43:12+00:00",
        "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..."
      }
    },
    {
      "type": "Plant",
      "id": "23508e6c-632a-496d-9bd6-8c62a03216af",
      "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"
          }
        ],
        "created": "2025-09-25T18:43:14+00:00",
        "updated": "2025-09-25T18:43:14+00:00",
        "name": "Lily",
        "scenario": "general.botanicExample",
        "scientificName": "L. candidum",
        "link": "https://en.wikipedia.org/wiki/Lilium_candidum",
        "description": "Lilium candidum, the Madonna lily[2][3] or white lily,[4] is a plant in the true lily family. It is ..."
      }
    },
    "... 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": 1758825856.933289,
      "end": 1758825857.210775,
      "duration": 0.27748584747314453
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "paths": [
                {
                  "nodeIds": [
                    "8940d70b-5b6f-43b7-bee4-41d073396ff8",
                    "1feedd9f-0c12-490c-8461-b12ff7447ac8",
                    "8288a39a-4b41-4ed5-8d0f-0b795048163c",
                    "... 2 more items omitted (shapes seen: string) ..."
                  ],
                  "relationIds": [
                    "ee29e267-63c8-45fb-a9a5-47835f46a839",
                    "81b19288-a74b-4496-84a9-0d07386b8e26",
                    "b60561b3-46d1-4632-9320-b0e02afa4198",
                    "9bea8667-ab81-48ff-871a-00334afc1a07"
                  ]
                },
                {
                  "nodeIds": [
                    "23508e6c-632a-496d-9bd6-8c62a03216af",
                    "7dd3a650-d60e-40c9-89d0-bccaf395369f",
                    "1feedd9f-0c12-490c-8461-b12ff7447ac8",
                    "... 3 more items omitted (shapes seen: string) ..."
                  ],
                  "relationIds": [
                    "e73faa5c-2c41-4d04-8a09-f160c4accea8",
                    "78228dfa-196a-48ef-9a46-e8fa5dc2628f",
                    "81b19288-a74b-4496-84a9-0d07386b8e26",
                    "... 2 more items omitted (shapes seen: string) ..."
                  ]
                },
                {
                  "nodeIds": [
                    "70965ab5-bc3e-4bbe-aacf-1b7e12b76110",
                    "9abc0ab3-fa1a-4138-80c1-49db5c4d082f",
                    "30cb4ff2-591f-4fba-aa47-ca6ada630b9a",
                    "1852bdff-a4dd-4f91-9243-0e802775f757"
                  ],
                  "relationIds": [
                    "e8e3fb73-5129-4cb3-99cd-d564e191d500",
                    "06faa138-14b9-48f1-b967-1ae536a9d3ef",
                    "ee933330-c413-4680-be79-03f51b18aa7b"
                  ]
                },
                {
                  "nodeIds": [
                    "258c0dfe-b1d8-4839-beed-d00d1b544a96",
                    "16884ac8-ba7a-4c91-8449-4fdd803644b6",
                    "b7cda919-deea-49f9-9151-49132f83cbff",
                    "1852bdff-a4dd-4f91-9243-0e802775f757"
                  ],
                  "relationIds": [
                    "b9fee9e3-f0c5-451c-b9a6-f5a3578e023c",
                    "024e049b-219a-477c-9b8c-be1244c16dab",
                    "49d9a28c-b712-4be6-9cf1-11d2062ffa89"
                  ]
                }
              ]
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758825857.210962,
      "element-hydration:redundantElementIds": {
        "message": "Removed 9 redundant elementIds.",
        "removedElementIds": [
          "1852bdff-a4dd-4f91-9243-0e802775f757",
          "1feedd9f-0c12-490c-8461-b12ff7447ac8",
          "425235d6-75ab-4ccb-8208-783ced0decc6",
          "... 4 more items omitted (shapes seen: string) ..."
        ]
      },
      "accessibleElementIds": [
        "024e049b-219a-477c-9b8c-be1244c16dab",
        "06faa138-14b9-48f1-b967-1ae536a9d3ef",
        "16884ac8-ba7a-4c91-8449-4fdd803644b6",
        "... 22 more items omitted (shapes seen: string) ..."
      ],
      "end": 1758825857.318839,
      "duration": 0.107877
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location
Allow: GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK
Cache-Control: no-cache, private
Content-Type: application/json; charset=utf-8
Date: Sat, 06 Sep 2025 14:57:35 GMT
Transfer-Encoding: chunked
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)
