API version: 0.3.0

---

# 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": [
                "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                "02IiNr0GOoKiPMLO9dQSP9Mmvy5E3YmZXDsBP",
                "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7"
              ]
            }
          },
          {
            "type": "element-hydration"
          }
        ]
      }' \
  https://api.example.com/search
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "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",
        "scenario": "general.botanicExample",
        "scientificName": "L. candidum",
        "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-05T12:16:05+00:00",
        "updatedAt": "2026-12-05T12:16:05+00:00"
      },
      "file": {
        "contentLength": 115168,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "ee066b93ae72c719f863a428f03c86ecd28e52818528eacf4d4e32acb4b4b37c"
        }
      },
      "metadata": {
        "score": 1
      }
    },
    {
      "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"
          }
        ],
        "hasFile": true,
        "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...",
        "createdAt": "2026-12-05T12:16:05+00:00",
        "updatedAt": "2026-12-05T12:16:05+00:00"
      },
      "file": {
        "contentLength": 90681,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "72e3e3770db795b2f04f0b5bb0be43e74df70de4faa0bf83a706bbde29e4ea0b"
        }
      },
      "metadata": {
        "score": 1
      }
    },
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7",
      "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"
          }
        ],
        "hasFile": true,
        "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...",
        "createdAt": "2026-12-05T12:16:05+00:00",
        "updatedAt": "2026-12-05T12:16:05+00:00"
      },
      "file": {
        "contentLength": 105488,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "c4c242897c43a74e9e4a8b5bf89e6b2cb1cbd99f8d621f33eea175cbf6dfab97"
        }
      },
      "metadata": {
        "score": 1
      }
    }
  ],
  "debug": [
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "terms": {
            "_id": "{{someElementIds}}"
          }
        },
        "parameters": {
          "someElementIds": [
            "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
            "02IiNr0GOoKiPMLO9dQSP9Mmvy5E3YmZXDsBP",
            "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7"
          ],
          "stepResults": []
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1796473117.654994,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "query": {
          "bool": {
            "must": [
              {
                "terms": {
                  "_id": [
                    "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                    "02IiNr0GOoKiPMLO9dQSP9Mmvy5E3YmZXDsBP",
                    "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7"
                  ]
                }
              }
            ],
            "filter": [
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "02IiNr0GOoKiPMM5A0eq9jHk2upaJezsVtWjL"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1796473117.749476,
      "duration": 0.094482
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "02IiNr0GOoKiPMLO9dQSP9Mmvy5E3YmZXDsBP",
                  "type": "Plant",
                  "metadata": {
                    "score": 1
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                  "type": "Plant",
                  "metadata": {
                    "score": 1
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7",
                  "type": "Plant",
                  "metadata": {
                    "score": 1
                  }
                }
              ],
              "totalHits": 3,
              "maxScore": 1
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1796473117.749879,
      "accessibleElementIds": [
        "02IiNr0GOoKiPMLO9dQSP9Mmvy5E3YmZXDsBP",
        "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
        "02IiNr0GOoKiPMMBnI2aIF8Qd4GH33FIAozo7"
      ],
      "end": 1796473117.760658,
      "duration": 0.010779
    }
  ]
}
```

##### 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:49 GMT
Transfer-Encoding: chunked
Vary: Prefer, Accept-Encoding
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: [Highlighting](/reference/search/elasticsearch-query-dsl-mixin/highlighting.md)
