API version: 0.3.0

---

# Parameterized element ids

Since `elementIds` accepts an
[expression](/reference/search/elasticsearch-query-dsl-mixin.md#parameterized-elasticsearch-queries) string instead of a
literal array, the list of ids to hydrate can be computed from the step's parameters. This example receives a list of
`elements` objects, each carrying an arbitrary `score`, and uses
[Expr Lang](/reference/formats-and-languages/expr-lang.md)'s `filter`, `sortBy` and `map` functions to keep only elements
scoring above `1.0`, sort them by score descending, and extract just their `id`s - all without a prior search step.

```bash
curl -X POST \
  -H 'Authorization: Bearer secret-token:PIPeJGUt7c00ENn8a5uDlc' \
  -H 'Content-Type: application/json' \
  -d '{
        "debug": true,
        "steps": [
          {
            "type": "element-hydration",
            "query": {
              "elementIds": "{{map(sortBy(filter(elements, #.score > 1.0), .score, \"desc\"), #.id)}}"
            },
            "parameters": {
              "elements": [
                {"id": "02IiNr0GOoKiPMMnmHcecC7H3P3IOipWs3wbB", "score": 0.9},
                {"id": "02IiNr0GOoKiPMLzlyajuxj3r003A91sQN0s8", "score": 4.0},
                {"id": "02IiNr0GOoKiPMMVF5V1KsKN9p11vzC3JU7xE", "score": 1.4},
                {"id": "02IiNr0GOoKiPMLh5LwCdzZMAqqP08VzcXmWl", "score": 3.2}
              ]
            }
          }
        ]
      }' \
  https://api.example.com/search
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMLzlyajuxj3r003A91sQN0s8",
      "data": {
        "images": [
          {
            "description": "White trillium (Trillium grandiflorum) blooming in Backus Woods.",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/e/e7/Trillium_grandiflorum_at_Backus_Woods.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Trillium_grandiflorum_at_Backus_Woods.jpg/...",
            "link": "https://en.wikipedia.org/wiki/File:Trillium_grandiflorum_at_Backus_Woods.jpg"
          },
          {
            "description": "Pink form of Trillium grandiflorum",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/0/0e/Trillium_grandiflorum_pink1.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Trillium_grandiflorum_pink1.jpg/960px-Tril...",
            "link": "https://en.wikipedia.org/wiki/File:Trillium_grandiflorum_pink1.jpg"
          },
          {
            "description": "Photograph of the flower of the White Trilliumen (Trillium grandiflorum en ). Photo taken at the Mt....",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/0/0c/White_Trillium_Trillium_grandiflorum_Flower_2613...",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/White_Trillium_Trillium_grandiflorum_Flowe...",
            "link": "https://en.wikipedia.org/wiki/File:White_Trillium_Trillium_grandiflorum_Flower_2613px.jpg"
          }
        ],
        "hasFile": true,
        "name": "Trillium",
        "scientificName": "T. grandiflorum",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Trillium_grandiflorum",
        "description": "Trillium grandiflorum, the white trillium, large-flowered trillium, great white trillium, white wake...",
        "createdAt": "2026-12-03T12:05:26+00:00",
        "updatedAt": "2026-12-03T12:05:26+00:00"
      },
      "file": {
        "contentLength": 52082,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "a235debeb572b5ab0cd3a84dfcf869dd558042dead656097fa5d414f2fee2b31"
        }
      }
    },
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMLh5LwCdzZMAqqP08VzcXmWl",
      "data": {
        "images": [
          {
            "description": "Hibiscus heterophyllus cultivated plant growing in Thirlmere",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/c/c8/Hibiscus_heterophyllus_flower_image.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Hibiscus_heterophyllus_flower_image.jpg/50...",
            "link": "https://en.wikipedia.org/wiki/File:Hibiscus_heterophyllus_flower_image.jpg"
          },
          {
            "description": "Hibiscus heterophyllus in flower, Chatswood West",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/1/19/Hibiscus_heterophyllus_Chatswood_West.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/1/19/Hibiscus_heterophyllus_Chatswood_West.jpg",
            "link": "https://en.wikipedia.org/wiki/File:Hibiscus_heterophyllus_Chatswood_West.jpg"
          }
        ],
        "hasFile": true,
        "name": "Hibiscus",
        "scientificName": "H. heterophyllus",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Hibiscus_heterophyllus",
        "description": "Hibiscus heterophyllus, commonly known as native rosella or toilet paper bush, is a flowering plant ...",
        "createdAt": "2026-12-03T12:05:26+00:00",
        "updatedAt": "2026-12-03T12:05:26+00:00"
      },
      "file": {
        "contentLength": 91123,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "9adcacd32ddda75b23007df4be9d74d85f1e768ae1a991891703e3d1bee64006"
        }
      }
    },
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMMVF5V1KsKN9p11vzC3JU7xE",
      "data": {
        "images": [
          {
            "description": "Arabian jasmin 'Grand Duke of Tuscany'",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/a/ab/Jasminum_sambac_%27Grand_Duke_of_Tuscany%27.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/ab/Jasminum_sambac_%27Grand_Duke_of_Tuscany%2...",
            "link": "https://en.wikipedia.org/wiki/File:Jasminum_sambac_%27Grand_Duke_of_Tuscany%27.jpg"
          }
        ],
        "hasFile": true,
        "name": "Jasmine",
        "scientificName": "J. sambac",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Jasminum_sambac",
        "description": "Jasminum sambac (Arabian jasmine or Sambac jasmine) is a species of jasmine native to Bhutan and Ind...",
        "createdAt": "2026-12-03T12:05:26+00:00",
        "updatedAt": "2026-12-03T12:05:26+00:00"
      },
      "file": {
        "contentLength": 27888,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "96e35f27fa6c148d68ba326b80f3172f4de2e08ad35127bd8e3e4fb006fb5176"
        }
      }
    }
  ],
  "debug": [
    {
      "input": {
        "type": "element-hydration",
        "query": {
          "elementIds": "{{map(sortBy(filter(elements, #.score > 1.0), .score, \"desc\"), #.id)}}"
        },
        "parameters": {
          "elements": [
            {
              "id": "02IiNr0GOoKiPMMnmHcecC7H3P3IOipWs3wbB",
              "score": 0.9
            },
            {
              "id": "02IiNr0GOoKiPMLzlyajuxj3r003A91sQN0s8",
              "score": 4
            },
            {
              "id": "02IiNr0GOoKiPMMVF5V1KsKN9p11vzC3JU7xE",
              "score": 1.4
            },
            {
              "id": "02IiNr0GOoKiPMLh5LwCdzZMAqqP08VzcXmWl",
              "score": 3.2
            }
          ],
          "stepResults": []
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1796299634.157363,
      "accessibleElementIds": [
        "02IiNr0GOoKiPMLzlyajuxj3r003A91sQN0s8",
        "02IiNr0GOoKiPMLh5LwCdzZMAqqP08VzcXmWl",
        "02IiNr0GOoKiPMMVF5V1KsKN9p11vzC3JU7xE"
      ],
      "end": 1796299634.294949,
      "duration": 0.137586
    }
  ]
}
```

##### 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:50 GMT
Transfer-Encoding: chunked
Vary: Prefer, Accept-Encoding
X-Powered-By: Ember Nexus API
```

The element scoring `0.9` is filtered out, and the remaining three are hydrated in descending score order - even
though they were listed in a different order in the input `elements` parameter.

**Note**: this same technique commonly appears as the last step of a multi-step pipeline, filtering or reordering the
`stepResults` of an earlier step rather than a client-supplied parameter.

---

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

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

Previous: [Explicit element ids](/reference/search/element-hydration/explicit-element-ids.md)

Next: [Text embedding](/reference/search/text-embedding.md)
