# WildCard in Exists API does not work as expected

**URL:** <https://discuss.elastic.co/t/wildcard-in-exists-api-does-not-work-as-expected/308554>\
**Category:** Elasticsearch\
**Created:** [June 30, 2022, 10:01am UTC](https://discuss.elastic.co/t/wildcard-in-exists-api-does-not-work-as-expected/308554 "2022-06-30T10:01:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tschodde](https://avatars.discourse-cdn.com/v4/letter/t/dbc845/32.png) [@tschodde](https://discuss.elastic.co/u/tschodde)\
**Post date:** [June 30, 2022, 10:01am UTC](https://discuss.elastic.co/t/wildcard-in-exists-api-does-not-work-as-expected/308554/1 "2022-06-30T10:01:06Z")

</div>

Dear all,  
I've tried the Exists API for indices and data-streams ( [Exists API | Elasticsearch Guide [8.3] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html#indices-exists)).  
If I understand it correction I can use wildcards in the target parameter. However, when using \* the call always returns 200 OK, doesn't matter with which string i combine it.

_Example:_  
Imagine we have a data-stream called "abc-logs-new".  
When using the **Exists API** by sending a **HEAD** request to "localhost:9200/abc-logs-\*" I get an **200 OK**. This is fine.  
Now I send a **HEAD** request to "localhost:9200/abc-def-\*" and also get the answer **200 OK** and not **404 NOT FOUND**.  
When removing the \* from the request URL and using an absolute name, it works and I get a **200 OK** for "localhost:9200/abc-logs-new" and a **404 NOT FOUND** for "localhost:9200/abc-def-new".

Am I using it wrongly? Thanks for your help.

All the best,  
Thorsten

---

<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:** [July 28, 2022, 10:01am UTC](https://discuss.elastic.co/t/wildcard-in-exists-api-does-not-work-as-expected/308554/2 "2022-07-28T10:01:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Quentin\_Pradet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quentin_pradet/32/94192_2.png) [@Quentin\_Pradet](https://discuss.elastic.co/u/Quentin_Pradet)\
**Post date:** [November 13, 2024, 10:59am UTC](https://discuss.elastic.co/t/wildcard-in-exists-api-does-not-work-as-expected/308554/3 "2024-11-13T10:59:46Z")

</div>

Since this is the top search result for "elasticsearch exists API wildcard 200", I wanted to mention that this behavior is [confusing but intended](https://github.com/elastic/elasticsearch/issues/52534#issuecomment-597193052).

To get 404 Not Found with wildcards, you need to pass `?allow_no_indices=true`, as documented in [Exists API | Elasticsearch Guide [8.16] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html#indices-exists-api-query-params).
