API version: 0.3.0

---

# Search

## General search process

Every search request is written in **search steps** - smaller execution units, which are specialized for one specific
database or technology. Results of earlier search steps are available to later search steps as input parameters,
allowing **cross-database search logic**.

**Note**: Due to security reasons, most search steps are limited in scope. Specific details and workarounds can be found
on their detail pages. See [choosing a search step](/guide/search/choosing-a-search-step.md) for guidance on which step
fits a given use case.

### How parameters are resolved

Every step can read a `parameters` object, which is assembled in the following priority order (later entries win):

1. Results of previous steps (available as `stepResults`).
2. Global `parameters`, set on the request body.
3. Step-local `parameters`, set on the individual step definition.

This means step-local parameters always take priority over global parameters, which in turn take priority over
whatever earlier steps returned - allowing later steps to override values injected by earlier ones.

### Failed search steps

If a search step fails, the response is a problem JSON which contains the debug data of all previous steps (`debug`),
the failed step (`failedStep`) and, if the failure could be diagnosed, the allowlisted error data of the database
(`failedStep.diagnostics`). The `debug` request property does not matter for failed requests, the debug data is always
returned. If `search.explainFailures` is disabled, only a short `400` without debug data and
failure details is returned. Raw database error messages are never forwarded, as they might contain stored data. See
[understanding search errors](/guide/search/understanding-search-errors.md) for details and examples.

## Search steps

### Elasticsearch query

Executes search queries against **Elasticsearch**. Great for full text search, explorative search requests, small logic
etc. Supports (almost) the full
[Elasticsearch Query DSL](https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl). See the
[detail page](/reference/search/elasticsearch-query-dsl-mixin.md) for its parameters, security aspects and examples.

### Cypher path query

Executes search queries against **Neo4j**. Great for structural search, e.g. "list all comments on blog post X". Uses a
restricted subset of Cypher 25 dedicated to path searches only, called Cypher Path Subset.
See the [detail page](/reference/search/cypher-path-subset.md) for its parameters, security aspects and examples.

Note that properties are internally split across several databases — see [databases](/reference/databases.md)
for how this affects queries targeting Neo4j directly.

### Text embedding

Turns a text into a vector with an embedding provider, for the kNN queries of a later Elasticsearch step. Requires the
capability `embedding.create`. See the [detail page](/reference/search/text-embedding.md) for its parameters and the
[vector search example](/reference/search/elasticsearch-query-dsl-mixin/vector-search.md).

### Element hydration

Converts a list of element ids to a collection response, containing elements and all their properties.\
This step is mostly used to convert results of other search steps to collection responses usable by clients, and is
therefore commonly used as the last step of a search request. See the [detail page](/reference/search/element-hydration.md)
for its parameters and examples.

## Examples

### Simple full text search

In this example, only Elasticsearch is queried for all elements, whose `description`-property contains the word
`lily`.\
The `element-hydration`-step only makes sure, that the results from Elasticsearch are correctly hydrated and returned.

See also
[Elasticsearch's documentation about the match query clause](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-query).

```json
{
  "debug": true,
  "steps": [
    {
      "type": "elasticsearch-query-dsl-mixin",
      "query": {
        "match": {
          "description": {
            "query": "lily"
          }
        }
      }
    },
    {
      "type": "element-hydration"
    }
  ]
}
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "Taxon",
      "id": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
      "data": {
        "createdAt": "2025-09-25T18:35:26+00:00",
        "updatedAt": "2025-09-25T18:35:26+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": "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
      "data": {
        "images": [
          {
            "description": "",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/f/fe/Flame_lily.png",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Flame_lily.png/500px-Flame_lily.png",
            "link": "https://en.wikipedia.org/wiki/File:Flame_lily.png"
          },
          {
            "description": "Gloriosa superba at Mabvuku, Harare, Zimbabwe",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/b/bc/Gloriosa_superba_1.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Gloriosa_superba_1.jpg/960px-Gloriosa_supe...",
            "link": "https://en.wikipedia.org/wiki/File:Gloriosa_superba_1.jpg"
          }
        ],
        "createdAt": "2025-09-25T18:35:28+00:00",
        "updatedAt": "2025-09-25T18:35:28+00:00",
        "name": "Flame Lily",
        "scenario": "general.botanicExample",
        "scientificName": "G. superba",
        "link": "https://en.wikipedia.org/wiki/Gloriosa_superba",
        "description": "Gloriosa superba is a species of flowering plant in the family Colchicaceae. Common names include fl..."
      }
    },
    {
      "type": "Taxon",
      "id": "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
      "data": {
        "createdAt": "2025-09-25T18:35:26+00:00",
        "updatedAt": "2025-09-25T18:35:26+00:00",
        "name": "Lilieae",
        "path": "/Plantae/Tracheophytes/Angiosperms/Monocots/Liliales/Liliaceae/Lilioideae/Lilieae",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Lilieae",
        "description": "The Lilieae are a monophyletic tribe of monocotyledon perennial, herbaceous mainly bulbous flowering..."
      }
    },
    "... 17 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "match": {
            "description": {
              "query": "lily"
            }
          }
        },
        "parameters": {
          "stepResults": []
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1758825391.222043,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "query": {
          "bool": {
            "must": [
              {
                "match": {
                  "description": {
                    "query": "lily"
                  }
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "02IiNr0GOoKiPMM5A0eq9jHk2upaJezsVtWjL"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1758825391.252388,
      "duration": 0.030345
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
                  "type": "Taxon",
                  "metadata": {
                    "score": 4.5739636
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                  "type": "Plant",
                  "metadata": {
                    "score": 3.9976888
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
                  "type": "Taxon",
                  "metadata": {
                    "score": 3.7564187
                  }
                },
                "... 17 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
              ],
              "totalHits": 20,
              "maxScore": 4.5739636
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758825391.25256,
      "accessibleElementIds": [
        "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
        "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
        "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
        "... 17 more items omitted (shapes seen: string) ..."
      ],
      "end": 1758825391.322722,
      "duration": 0.070162
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: OPTIONS, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location
Allow: OPTIONS, POST
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
```

As Elasticsearch only returns individual elements, no paths can be observed.

### Simple path search

In this example, only Neo4j is queried for all paths, which satisfy `(:Plant)-[:HAS_TAG]->(:Tag {name: "blue"})` - i.e.
all plants, which are tagged `blue`.\
The `element-hydration`-step only makes sure, that the results from Neo4j are correctly hydrated and returned.

```json
{
  "debug": true,
  "steps": [
    {
      "type": "cypher-path-subset",
      "query": "MATCH path=((:Plant)-[:HAS_TAG]->(:Tag {name: \"blue\"})) RETURN path"
    },
    {
      "type": "element-hydration"
    }
  ]
}
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMM3n6dNmfvWddQqpN1iow5gs",
      "data": {
        "images": [
          {
            "description": "Strelitzia reginae or Bird of Paradise",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/5/55/Bird_of_Paradise_flower.JPG",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/5/55/Bird_of_Paradise_flower.JPG/960px-Bird_of_...",
            "link": "https://en.wikipedia.org/wiki/File:Bird_of_Paradise_flower.JPG"
          },
          {
            "description": "Portugal, Madeira, Botanical garden in Funchal",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/6/68/2010-03-05_13_16_21_Portugal-Jardim_Bot%C3%A2nic...",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/2010-03-05_13_16_21_Portugal-Jardim_Bot%C3...",
            "link": "https://en.wikipedia.org/wiki/File:2010-03-05_13_16_21_Portugal-Jardim_Bot%C3%A2nico_da_Madeira.jpg"
          }
        ],
        "createdAt": "2025-09-25T18:43:14+00:00",
        "updatedAt": "2025-09-25T18:43:14+00:00",
        "name": "Bird of Paradise",
        "scenario": "general.botanicExample",
        "scientificName": "S. reginae",
        "link": "https://en.wikipedia.org/wiki/Strelitzia_reginae",
        "description": "Strelitzia reginae, commonly known as the crane flower, bird of paradise, or isigude in Nguni,[3] is..."
      }
    },
    {
      "type": "Tag",
      "id": "02IiNr0GOoKiPMM4FOCWJ7N93GB5Ih1r74WAy",
      "data": {
        "description": "Blue is one of the three primary colours in the RGB (additive) colour model, as well as in the RYB c...",
        "createdAt": "2025-09-25T18:43:12+00:00",
        "updatedAt": "2025-09-25T18:43:12+00:00",
        "name": "blue",
        "color": "#4363d8",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Blue"
      }
    },
    {
      "type": "HAS_TAG",
      "id": "02IiNr0GOoKiPMMG3SzbryY0vVeLSnkspLiXL",
      "start": "02IiNr0GOoKiPMM3n6dNmfvWddQqpN1iow5gs",
      "end": "02IiNr0GOoKiPMM4FOCWJ7N93GB5Ih1r74WAy",
      "data": {
        "createdAt": "2025-09-25T18:43:24+00:00",
        "updatedAt": "2025-09-25T18:43:24+00:00",
        "scenario": "general.botanicExample"
      }
    },
    "... 10 more items omitted (shapes seen: type:Plant, type:Tag, type:HAS_TAG) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "cypher-path-subset",
        "query": "MATCH path=((:Plant)-[:HAS_TAG]->(:Tag {name: \"blue\"})) RETURN path",
        "parameters": {
          "stepResults": []
        }
      },
      "step-handler": "cypher-path-subset (App\\EventSystem\\SearchStep\\EventListener\\CypherPathSearchStepEventListener)",
      "start": 1758825857.489016,
      "end": 1758825857.750409,
      "duration": 0.26139283180236816
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "paths": [
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMMTRjVFHTxeRcXTS8U2uHHvD",
                    "02IiNr0GOoKiPMM4FOCWJ7N93GB5Ih1r74WAy"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMN06V2Vd6foXx8M5oj4UBdv9"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMM3n6dNmfvWddQqpN1iow5gs",
                    "02IiNr0GOoKiPMM4FOCWJ7N93GB5Ih1r74WAy"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMG3SzbryY0vVeLSnkspLiXL"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMMBJC6MvmdzszbF1DfOpDzCy",
                    "02IiNr0GOoKiPMM4FOCWJ7N93GB5Ih1r74WAy"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMN2qO7DkDedGvWv3XocVljHc"
                  ]
                },
                "... 3 more items omitted (shapes seen: nodeIds,relationIds) ..."
              ]
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758825857.75059,
      "element-hydration:redundantElementIds": {
        "message": "Removed 5 redundant elementIds.",
        "removedElementIds": [
          "02IiNr0GOoKiPMM4FOCWJ7N93GB5Ih1r74WAy"
        ]
      },
      "accessibleElementIds": [
        "02IiNr0GOoKiPMM3n6dNmfvWddQqpN1iow5gs",
        "02IiNr0GOoKiPMM4FOCWJ7N93GB5Ih1r74WAy",
        "02IiNr0GOoKiPMM95MrKH8ljX349BOQ3hyMlZ",
        "... 10 more items omitted (shapes seen: string) ..."
      ],
      "end": 1758825857.812404,
      "duration": 0.061814
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: OPTIONS, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location
Allow: OPTIONS, POST
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
```

The graph view can actually display a graph, because we queried relations and all paths share a common node - the tag
`blue`.

### Combined full text and path search

An example how results from Elasticsearch - all elements whose description contain the word `lily` - are feed as input
parameters to Neo4j, which then expands the results to the path `(:Plant)-[:IS_MEMBER_OF*..]->(:Taxon)`.\
Note that because we map Elasticsearch's results to only `:Plant`-nodes, we filter out other results from Elasticsearch,
e.g. Taxons which also contain the word `lily`.

```json
{
  "debug": true,
  "steps": [
    {
      "type": "elasticsearch-query-dsl-mixin",
      "query": {
        "match": {
          "description": {
            "query": "lily"
          }
        }
      }
    },
    {
      "type": "cypher-path-subset",
      "query": "UNWIND $stepResults[0].elements AS element MATCH path=((plant:Plant)-[:IS_MEMBER_OF*..]->(:Taxon)) WHERE plant.id = element.id RETURN path"
    },
    {
      "type": "element-hydration"
    }
  ]
}
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "IS_MEMBER_OF",
      "id": "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf",
      "start": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
      "end": "02IiNr0GOoKiPMMYRIBtxoQ2Nx3g0G3igcbuW",
      "data": {
        "createdAt": "2025-09-25T18:35:34+00:00",
        "updatedAt": "2025-09-25T18:35:34+00:00",
        "scenario": "general.botanicExample"
      }
    },
    {
      "type": "Taxon",
      "id": "02IiNr0GOoKiPMLEgoaUaFd7Pq6umCqWXkhiX",
      "data": {
        "createdAt": "2025-09-25T18:35:26+00:00",
        "updatedAt": "2025-09-25T18:35:26+00:00",
        "name": "Magnoliaceae",
        "path": "/Plantae/Tracheophytes/Angiosperms/Magnoliids/Magnoliales/Magnoliaceae",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Magnoliaceae",
        "description": "The Magnoliaceae (/mæɡˌnoʊliˈeɪsii/) are a flowering plant family, the magnolia family, in the order..."
      }
    },
    {
      "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"
          }
        ],
        "createdAt": "2025-09-25T18:35:28+00:00",
        "updatedAt": "2025-09-25T18:35:28+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 ..."
      }
    },
    "... 78 more items omitted (shapes seen: type:IS_MEMBER_OF, type:Taxon, type:Plant) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "match": {
            "description": {
              "query": "lily"
            }
          }
        },
        "parameters": {
          "stepResults": []
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1758825393.576418,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "query": {
          "bool": {
            "must": [
              {
                "match": {
                  "description": {
                    "query": "lily"
                  }
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "02IiNr0GOoKiPMM5A0eq9jHk2upaJezsVtWjL"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1758825393.608732,
      "duration": 0.032314
    },
    {
      "input": {
        "type": "cypher-path-subset",
        "query": "UNWIND $stepResults[0].elements AS element MATCH path=((plant:Plant)-[:IS_MEMBER_OF*..]->(:Taxon)) WHERE plant.id = element.id RETURN path",
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
                  "type": "Taxon",
                  "metadata": {
                    "score": 4.5739636
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                  "type": "Plant",
                  "metadata": {
                    "score": 3.9976888
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
                  "type": "Taxon",
                  "metadata": {
                    "score": 3.7564187
                  }
                },
                "... 17 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
              ],
              "totalHits": 20,
              "maxScore": 4.5739636
            }
          ]
        }
      },
      "step-handler": "cypher-path-subset (App\\EventSystem\\SearchStep\\EventListener\\CypherPathSearchStepEventListener)",
      "start": 1758825393.608918,
      "end": 1758825394.031818,
      "duration": 0.4228999614715576
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
                  "type": "Taxon",
                  "metadata": {
                    "score": 4.5739636
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                  "type": "Plant",
                  "metadata": {
                    "score": 3.9976888
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
                  "type": "Taxon",
                  "metadata": {
                    "score": 3.7564187
                  }
                },
                "... 17 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
              ],
              "totalHits": 20,
              "maxScore": 4.5739636
            },
            {
              "paths": [
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                    "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMZVLUkwbKeM2UFyiSIJvEuY"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                    "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
                    "02IiNr0GOoKiPMMYRIBtxoQ2Nx3g0G3igcbuW"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMZVLUkwbKeM2UFyiSIJvEuY",
                    "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                    "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
                    "02IiNr0GOoKiPMMYRIBtxoQ2Nx3g0G3igcbuW",
                    "02IiNr0GOoKiPMLInXm7QkEoxFbe837GDR9EV"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMZVLUkwbKeM2UFyiSIJvEuY",
                    "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf",
                    "02IiNr0GOoKiPMLgu4qdyIrJEVzhM69wTc2v5"
                  ]
                },
                "... 62 more items omitted (shapes seen: nodeIds,relationIds) ..."
              ]
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758825394.032423,
      "element-hydration:redundantElementIds": {
        "message": "Removed 584 redundant elementIds.",
        "removedElementIds": [
          "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf",
          "02IiNr0GOoKiPML8y6vkBrD3oTNHHMdcOMBrg",
          "02IiNr0GOoKiPMLEgoaUaFd7Pq6umCqWXkhiX",
          "... 78 more items omitted (shapes seen: string) ..."
        ]
      },
      "accessibleElementIds": [
        "02IiNr0GOoKiPML83WdXY5NaL0FTZMHqezWjf",
        "02IiNr0GOoKiPML8y6vkBrD3oTNHHMdcOMBrg",
        "02IiNr0GOoKiPMLEgoaUaFd7Pq6umCqWXkhiX",
        "... 78 more items omitted (shapes seen: string) ..."
      ],
      "end": 1758825394.361263,
      "duration": 0.32884
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: OPTIONS, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location
Allow: OPTIONS, POST
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
```

Due to the unlimited path length, the resulting graph can become quite big.

Duplicated nodes etc. are already filtered out by the API itself, as can be seen in the debug view.

### Cypher-first polyglot search

Polyglot pipelines do not need to start with Elasticsearch - a Cypher step can run first and pass its results on to a
later Elasticsearch step instead. Here, Neo4j is queried for all plants tagged with a color given as a global
parameter (`color: "red"`), and the resulting node ids are then combined with a full text search against
Elasticsearch, further restricting the plants to those whose `description` also mentions the same color.\
Both the `color` parameter and the previous step's `nodeIds` are substituted into the Elasticsearch query as
[expressions](/reference/search/elasticsearch-query-dsl-mixin.md#parameterized-elasticsearch-queries).

```json
{
  "debug": true,
  "steps": [
    {
      "type": "cypher-path-subset",
      "query": "MATCH path=((plant:Plant)-[:HAS_TAG]->(:Tag {name: $color})) RETURN path ORDER BY plant.name"
    },
    {
      "type": "elasticsearch-query-dsl-mixin",
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "description": {
                  "query": "{{color}}"
                }
              }
            },
            {
              "terms": {
                "_id": "{{map(stepResults[0].paths, #.nodeIds[0])}}"
              }
            }
          ]
        }
      }
    },
    {
      "type": "element-hydration"
    }
  ],
  "parameters": {
    "color": "red"
  }
}
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMMOl8r9GYPjV8ztcCoVu9WBy",
      "data": {
        "images": [
          {
            "description": "Wild columbine (Aquilegia canadensis) in Talcott Mountain State Park",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/9/93/Wild_Columbine.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Wild_Columbine.jpg/960px-Wild_Columbine.jp...",
            "link": "https://en.wikipedia.org/wiki/File:Wild_Columbine.jpg"
          },
          {
            "description": "Wild Columbine (Aquilegia canadensis) in Normal, IL. Shows flower and seed pod.",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/5/57/Aquilegia_canadensis_Redmarkviolinist.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/5/57/Aquilegia_canadensis_Redmarkviolinist.jpg/...",
            "link": "https://en.wikipedia.org/wiki/File:Aquilegia_canadensis_Redmarkviolinist.jpg"
          }
        ],
        "createdAt": "2025-09-25T18:35:28+00:00",
        "updatedAt": "2025-09-25T18:35:28+00:00",
        "name": "Columbine",
        "scenario": "general.botanicExample",
        "scientificName": "A. canadensis",
        "link": "https://en.wikipedia.org/wiki/Aquilegia_canadensis",
        "description": "Aquilegia canadensis, the Canadian or Canada columbine, eastern red columbine, or wild columbine, is..."
      }
    },
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMMxXyCCZXekBCa1eLHhIphFh",
      "data": {
        "images": [
          {
            "description": "Flowering Corymbia ficifolia, Austins Ferry, Tasmania, Australia",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/a/a4/Corymbia_ficifolia_Flowers.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Corymbia_ficifolia_Flowers.jpg/500px-Corym...",
            "link": "https://en.wikipedia.org/wiki/File:Corymbia_ficifolia_Flowers.jpg"
          },
          {
            "description": "",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Corymbia_ficifolia_in_Berkeley_California....",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Corymbia_ficifolia_in_Berkeley_California....",
            "link": "https://en.wikipedia.org/wiki/File:Corymbia_ficifolia_in_Berkeley_California.jpg"
          }
        ],
        "createdAt": "2025-09-25T18:35:28+00:00",
        "updatedAt": "2025-09-25T18:35:28+00:00",
        "name": "Eucalyptus Blossom",
        "scenario": "general.botanicExample",
        "scientificName": "C. ficifolia",
        "link": "https://en.wikipedia.org/wiki/Corymbia_ficifolia",
        "description": "Corymbia ficifolia, commonly known as red flowering gum,[2] is a species of small tree that is endem..."
      }
    },
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMM0zWc5xa4RaB228AcjaruYb",
      "data": {
        "images": [
          {
            "description": "",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/8/84/Bromeliaceae03.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/8/84/Bromeliaceae03.jpg/500px-Bromeliaceae03.jp...",
            "link": "https://en.wikipedia.org/wiki/File:Bromeliaceae03.jpg"
          }
        ],
        "createdAt": "2025-09-25T18:35:28+00:00",
        "updatedAt": "2025-09-25T18:35:28+00:00",
        "name": "Bromeliad",
        "scenario": "general.botanicExample",
        "scientificName": "G. lingulata",
        "link": "https://en.wikipedia.org/wiki/Guzmania_lingulata",
        "description": "Guzmania lingulata, the droophead tufted airplant or scarlet star, is a species of flowering plant i..."
      }
    },
    "... 6 more items omitted (shapes seen: type:Plant) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "cypher-path-subset",
        "query": "MATCH path=((plant:Plant)-[:HAS_TAG]->(:Tag {name: $color})) RETURN path ORDER BY plant.name",
        "parameters": {
          "color": "red",
          "stepResults": []
        }
      },
      "step-handler": "cypher-path-subset (App\\EventSystem\\SearchStep\\EventListener\\CypherPathSearchStepEventListener)",
      "start": 1758825392.880632,
      "end": 1758825393.209822,
      "duration": 0.3291900157928467
    },
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "bool": {
            "must": [
              {
                "match": {
                  "description": {
                    "query": "{{color}}"
                  }
                }
              },
              {
                "terms": {
                  "_id": "{{map(stepResults[0].paths, #.nodeIds[0])}}"
                }
              }
            ]
          }
        },
        "parameters": {
          "color": "red",
          "stepResults": [
            {
              "paths": [
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMMzUkLSUV19YpeC9i6HEn4pz",
                    "02IiNr0GOoKiPMM4jZCMVnOvOsSB4aokKxQkw"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMLHyam0wL0jqvXDJOSDXU73s"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMM3n6dNmfvWddQqpN1iow5gs",
                    "02IiNr0GOoKiPMM4jZCMVnOvOsSB4aokKxQkw"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMLCUvIDdam8xeMX32CvdjaLC"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMMDtWZdp6n3301Hj7eiu8KJj",
                    "02IiNr0GOoKiPMM4jZCMVnOvOsSB4aokKxQkw"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMO5ddiGtDIYvAmbUXeD5wyf"
                  ]
                },
                "... 23 more items omitted (shapes seen: nodeIds,relationIds) ..."
              ]
            }
          ]
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1758825393.21006,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "query": {
          "bool": {
            "must": [
              {
                "bool": {
                  "must": [
                    {
                      "match": {
                        "description": {
                          "query": "red"
                        }
                      }
                    },
                    {
                      "terms": {
                        "_id": [
                          "02IiNr0GOoKiPMMzUkLSUV19YpeC9i6HEn4pz",
                          "02IiNr0GOoKiPMM3n6dNmfvWddQqpN1iow5gs",
                          "02IiNr0GOoKiPMMDtWZdp6n3301Hj7eiu8KJj",
                          "02IiNr0GOoKiPMMCQxJcPe8mpXoQaoRkmrGUO",
                          "02IiNr0GOoKiPMM0zWc5xa4RaB228AcjaruYb",
                          "02IiNr0GOoKiPMMuCOaQ7owFF6ZZSMDSunl8c",
                          "02IiNr0GOoKiPMMEkKZUr8qGcaW2KHWkNHp52",
                          "02IiNr0GOoKiPMMqFBSm7mEa55Z1H2wyuW3DG",
                          "02IiNr0GOoKiPMLyDo9l1EhZeSiDNcb8MiUnL",
                          "02IiNr0GOoKiPMMOl8r9GYPjV8ztcCoVu9WBy",
                          "02IiNr0GOoKiPMMsaT1tEcBrG4BGJuqZDcuqy",
                          "02IiNr0GOoKiPMMr41NLkpxWBZFZ6Xwo147EV",
                          "02IiNr0GOoKiPMMxXyCCZXekBCa1eLHhIphFh",
                          "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                          "02IiNr0GOoKiPMMDm1cFEl9vIyDymJp8bRRIM",
                          "02IiNr0GOoKiPMLibj4gGzuijDo1ZzLZfdBBk",
                          "02IiNr0GOoKiPMLboyANUdqsqIhQwzeFV8kkd",
                          "02IiNr0GOoKiPMLTwCRBMN41sHfs98l9qwQEw",
                          "02IiNr0GOoKiPMMdnKdcCPuiKxtxOEB3AwpUr",
                          "02IiNr0GOoKiPMMcbmkVolItxERbKJorXmPO1",
                          "02IiNr0GOoKiPMLwdeiCMOecKPD2BhZa9NM3N",
                          "02IiNr0GOoKiPMN2Rn6ObeagiSOhxh9ODx7vZ",
                          "02IiNr0GOoKiPMLEezecUZIcqABdykANm0j0F",
                          "02IiNr0GOoKiPMLXgLXgpyuj79BTq1RMTdEB1",
                          "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7",
                          "02IiNr0GOoKiPMLEM6a6wMkX6SvIR7Q7XFS4k"
                        ]
                      }
                    }
                  ]
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "02IiNr0GOoKiPMM5A0eq9jHk2upaJezsVtWjL"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1758825393.372277,
      "duration": 0.162217
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "color": "red",
          "stepResults": [
            {
              "paths": [
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMMzUkLSUV19YpeC9i6HEn4pz",
                    "02IiNr0GOoKiPMM4jZCMVnOvOsSB4aokKxQkw"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMLHyam0wL0jqvXDJOSDXU73s"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMM3n6dNmfvWddQqpN1iow5gs",
                    "02IiNr0GOoKiPMM4jZCMVnOvOsSB4aokKxQkw"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMLCUvIDdam8xeMX32CvdjaLC"
                  ]
                },
                {
                  "nodeIds": [
                    "02IiNr0GOoKiPMMDtWZdp6n3301Hj7eiu8KJj",
                    "02IiNr0GOoKiPMM4jZCMVnOvOsSB4aokKxQkw"
                  ],
                  "relationIds": [
                    "02IiNr0GOoKiPMMO5ddiGtDIYvAmbUXeD5wyf"
                  ]
                },
                "... 23 more items omitted (shapes seen: nodeIds,relationIds) ..."
              ]
            },
            {
              "elements": [
                {
                  "id": "02IiNr0GOoKiPMMOl8r9GYPjV8ztcCoVu9WBy",
                  "type": "Plant",
                  "metadata": {
                    "score": 3.463559
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMMxXyCCZXekBCa1eLHhIphFh",
                  "type": "Plant",
                  "metadata": {
                    "score": 3.296052
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMM0zWc5xa4RaB228AcjaruYb",
                  "type": "Plant",
                  "metadata": {
                    "score": 3.206095
                  }
                },
                "... 6 more items omitted (shapes seen: type:Plant) ..."
              ],
              "totalHits": 9,
              "maxScore": 3.463559
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758825393.372446,
      "accessibleElementIds": [
        "02IiNr0GOoKiPMMOl8r9GYPjV8ztcCoVu9WBy",
        "02IiNr0GOoKiPMMxXyCCZXekBCa1eLHhIphFh",
        "02IiNr0GOoKiPMM0zWc5xa4RaB228AcjaruYb",
        "... 6 more items omitted (shapes seen: string) ..."
      ],
      "end": 1758825393.410484,
      "duration": 0.038038
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: OPTIONS, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location
Allow: OPTIONS, POST
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
```

Only plants tagged `red` whose description also contains the word "red" are returned - the Cypher step narrows the
candidate set structurally, while the Elasticsearch step re-checks the text content of exactly those candidates.

---

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

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

Previous: [Upload](/reference/elements/upload.md)

Next: [Elasticsearch query](/reference/search/elasticsearch-query-dsl-mixin.md)
