API version: dev

---

# Parameterized search

This example shows how to inject client-provided data into an Elasticsearch Query DSL query using an
[expression](/reference/search/elasticsearch-query-dsl-mixin.md#parameterized-elasticsearch-queries). The `{{someElementIds}}`
placeholder is replaced with the `someElementIds` step parameter before the query is sent to Elasticsearch, resulting in
a [`terms` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-terms-query) that matches
exactly the three given element ids.\
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": "elasticsearch-query-dsl-mixin",
            "query": {
              "terms": {
                "_id": "{{someElementIds}}"
              }
            },
            "parameters": {
              "someElementIds": [
                "258c0dfe-b1d8-4839-beed-d00d1b544a96",
                "23508e6c-632a-496d-9bd6-8c62a03216af",
                "8940d70b-5b6f-43b7-bee4-41d073396ff8"
              ]
            }
          },
          {
            "type": "element-hydration"
          }
        ]
      }' \
  https://api.example.com/search
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "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:35:28+00:00",
        "updated": "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 ..."
      }
    },
    {
      "type": "Plant",
      "id": "258c0dfe-b1d8-4839-beed-d00d1b544a96",
      "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"
          }
        ],
        "created": "2025-09-25T18:35:28+00:00",
        "updated": "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": "Plant",
      "id": "8940d70b-5b6f-43b7-bee4-41d073396ff8",
      "data": {
        "images": [
          {
            "description": "in Seoul Forest, South Korea",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/7/7b/Tulips_in_Seoul_Forest%2C_South_Korea1.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Tulips_in_Seoul_Forest%2C_South_Korea1.jpg...",
            "link": "https://en.wikipedia.org/wiki/File:Tulips_in_Seoul_Forest,_South_Korea1.jpg"
          },
          {
            "description": "A Yonina cultivar (Division 6) tulip at the Tulip Fest in Albany, New York, United States.",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/7/7b/Yonina_Tulip.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Yonina_Tulip.jpg/960px-Yonina_Tulip.jpg",
            "link": "https://en.wikipedia.org/wiki/File:Yonina_Tulip.jpg"
          },
          {
            "description": "Tulipa orphanidea, garden plant",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/c/c4/Tulipa_orphanidea_060506.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Tulipa_orphanidea_060506.jpg/500px-Tulipa_...",
            "link": "https://en.wikipedia.org/wiki/File:Tulipa_orphanidea_060506.jpg"
          }
        ],
        "created": "2025-09-25T18:35:26+00:00",
        "updated": "2025-09-25T18:35:26+00:00",
        "name": "Tulip",
        "scenario": "general.botanicExample",
        "scientificName": "Tulipa",
        "link": "https://en.wikipedia.org/wiki/Tulip",
        "description": "Tulips are spring-blooming perennial herbaceous bulbiferous geophytes in the Tulipa genus. Their flo..."
      }
    }
  ],
  "debug": [
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "terms": {
            "_id": "{{someElementIds}}"
          }
        },
        "parameters": {
          "someElementIds": [
            "258c0dfe-b1d8-4839-beed-d00d1b544a96",
            "23508e6c-632a-496d-9bd6-8c62a03216af",
            "8940d70b-5b6f-43b7-bee4-41d073396ff8"
          ],
          "stepResults": []
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1758825390.715234,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "query": {
          "bool": {
            "must": [
              {
                "terms": {
                  "_id": [
                    "258c0dfe-b1d8-4839-beed-d00d1b544a96",
                    "23508e6c-632a-496d-9bd6-8c62a03216af",
                    "8940d70b-5b6f-43b7-bee4-41d073396ff8"
                  ]
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "7baba8b7-a6bb-4184-9a9a-925a4d2736b0"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1758825390.823238,
      "duration": 0.108004
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "23508e6c-632a-496d-9bd6-8c62a03216af",
                  "type": "Plant",
                  "metadata": {
                    "score": 1.0101794
                  }
                },
                {
                  "id": "258c0dfe-b1d8-4839-beed-d00d1b544a96",
                  "type": "Plant",
                  "metadata": {
                    "score": 1.0101794
                  }
                },
                {
                  "id": "8940d70b-5b6f-43b7-bee4-41d073396ff8",
                  "type": "Plant",
                  "metadata": {
                    "score": 1.0101794
                  }
                }
              ],
              "totalHits": 3,
              "maxScore": 1.0101794
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758825390.823414,
      "accessibleElementIds": [
        "23508e6c-632a-496d-9bd6-8c62a03216af",
        "258c0dfe-b1d8-4839-beed-d00d1b544a96",
        "8940d70b-5b6f-43b7-bee4-41d073396ff8"
      ],
      "end": 1758825390.844799,
      "duration": 0.021385
    }
  ]
}
```

##### 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
```

All three elements referenced by `someElementIds` are returned, in the order Elasticsearch ranks them - not necessarily
the order they were listed in the parameter.

---

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

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

Previous: [Wildcard search](/reference/search/elasticsearch-query-dsl-mixin/wildcard-search.md)

Next: [Cypher path query](/reference/search/cypher-path-subset.md)
