API version: dev

---

# Wildcard search

This example uses Elasticsearch's [`wildcard` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-wildcard-query)
to find all elements whose `description` contains a word matching the pattern `colo*r` - i.e. both the American
spelling "color" and the British spelling "colour" - restricted to the first page of `5` results via the `pageSize`
step parameter.\
Results are then [hydrated](/reference/search/element-hydration.md), i.e. transformed into a collection response.

**Note**: like `prefix`, `wildcard` is a term-level query and is matched against the exact indexed value. `*` matches
zero or more characters, `?` matches exactly one character.

```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": {
              "wildcard": {
                "description": {
                  "value": "colo*r"
                }
              }
            },
            "parameters": {
              "pageSize": 5
            }
          },
          {
            "type": "element-hydration"
          }
        ]
      }' \
  https://api.example.com/search
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "Tag",
      "id": "90819566-3121-42af-bdb5-19cbef67cd31",
      "data": {
        "description": "White is the lightest color[2] and is achromatic (having no chroma). It is the color of objects such...",
        "created": "2025-09-25T18:45:42+00:00",
        "updated": "2025-09-25T18:45:42+00:00",
        "name": "white",
        "color": "#ffffff",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/White"
      }
    },
    {
      "type": "Tag",
      "id": "b7121a49-8f17-4858-b988-4bd837a5f1fe",
      "data": {
        "created": "2025-09-25T18:45:42+00:00",
        "updated": "2025-09-25T18:45:42+00:00",
        "name": "lavender",
        "color": "#dcbeff",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Lavender_(color)",
        "description": "Lavender is a light shade of purple or violet. It applies particularly to the color of the flower of..."
      }
    },
    {
      "type": "Tag",
      "id": "b8674d32-af5f-4ef1-a5d8-fc5cbb56b795",
      "data": {
        "description": "Purple is a color similar in appearance to violet light. In the RYB color model historically used in...",
        "created": "2025-09-25T18:45:42+00:00",
        "updated": "2025-09-25T18:45:42+00:00",
        "name": "purple",
        "color": "#911eb4",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Purple"
      }
    },
    "... 2 more items omitted (shapes seen: type:Tag) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "wildcard": {
            "description": {
              "value": "colo*r"
            }
          }
        },
        "parameters": {
          "pageSize": 5,
          "stepResults": []
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1758826006.799941,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 5,
        "query": {
          "bool": {
            "must": [
              {
                "wildcard": {
                  "description": {
                    "value": "colo*r"
                  }
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "7baba8b7-a6bb-4184-9a9a-925a4d2736b0"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1758826006.829988,
      "duration": 0.030047
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "90819566-3121-42af-bdb5-19cbef67cd31",
                  "type": "Tag",
                  "metadata": {
                    "score": 1.0219789
                  }
                },
                {
                  "id": "b7121a49-8f17-4858-b988-4bd837a5f1fe",
                  "type": "Tag",
                  "metadata": {
                    "score": 1.0219789
                  }
                },
                {
                  "id": "b8674d32-af5f-4ef1-a5d8-fc5cbb56b795",
                  "type": "Tag",
                  "metadata": {
                    "score": 1.0219789
                  }
                },
                "... 2 more items omitted (shapes seen: type:Tag) ..."
              ],
              "totalHits": 29,
              "maxScore": 1.0219789
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758826006.830163,
      "accessibleElementIds": [
        "90819566-3121-42af-bdb5-19cbef67cd31",
        "b7121a49-8f17-4858-b988-4bd837a5f1fe",
        "b8674d32-af5f-4ef1-a5d8-fc5cbb56b795",
        "... 2 more items omitted (shapes seen: string) ..."
      ],
      "end": 1758826006.864428,
      "duration": 0.034265
    }
  ]
}
```

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

The response only contains the first `5` of `29` total matching elements, as requested via `pageSize`.

---

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

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

Previous: [Text prefix search](/reference/search/elasticsearch-query-dsl-mixin/text-prefix-search.md)

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