# Query DSL: How to use WILDCARD queries on \_id

**URL:** <https://discuss.elastic.co/t/query-dsl-how-to-use-wildcard-queries-on-id/285547>\
**Category:** Elasticsearch\
**Created:** [September 30, 2021, 7:29am UTC](https://discuss.elastic.co/t/query-dsl-how-to-use-wildcard-queries-on-id/285547 "2021-09-30T07:29:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelk](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@kelk](https://discuss.elastic.co/u/kelk)\
**Post date:** [September 30, 2021, 7:29am UTC](https://discuss.elastic.co/t/query-dsl-how-to-use-wildcard-queries-on-id/285547/1 "2021-09-30T07:29:44Z")

</div>

How to use WILDCARD queries on \_id  
While searching for specific type of Watcher runs (triggered\_watches), I was looking for a run of a specific type of watcher which contains a keyword in the \_id. But when I do a wildcard on \_id, it throws below error.  
How to do wildcard queries on \_id?

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "query_shard_exception",
        "reason" : "Can only use wildcard queries on keyword, text and wildcard fields - not on [_id] which is of type [_id]",
        "index_uuid" : "SnC46pycQYaCAh087OsXAQ",
        "index" : ".triggered_watches"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : ".triggered_watches",
        "node" : "q-9vxgtYQy2xxxxxqRQ",
        "reason" : {
          "type" : "query_shard_exception",
          "reason" : "Can only use wildcard queries on keyword, text and wildcard fields - not on [_id] which is of type [_id]",
          "index_uuid" : "SnC46pycQYxxxxxXAQ",
          "index" : ".triggered_watches"
        }
      }
    ]
  },
  "status" : 400
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 28, 2021, 7:29am UTC](https://discuss.elastic.co/t/query-dsl-how-to-use-wildcard-queries-on-id/285547/2 "2021-10-28T07:29:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
