# Check if index pattern exists using curl

**URL:** <https://discuss.elastic.co/t/check-if-index-pattern-exists-using-curl/319408>\
**Category:** Elasticsearch\
**Created:** [November 21, 2022, 9:24am UTC](https://discuss.elastic.co/t/check-if-index-pattern-exists-using-curl/319408 "2022-11-21T09:24:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neelam\_Zanvar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neelam_zanvar/32/103116_2.png) [@Neelam\_Zanvar](https://discuss.elastic.co/u/Neelam_Zanvar)\
**Post date:** [November 21, 2022, 9:24am UTC](https://discuss.elastic.co/t/check-if-index-pattern-exists-using-curl/319408/1 "2022-11-21T09:24:56Z")

</div>

Hi i am using ansible to create index patterns and data views in elk. Before creating a data view for a index pattern i would want to check if index pattern exists.  
Currently using this command

```auto
curl -I -XHEAD --write-out %{http_code} --silent --output /dev/null http:// **.**. **.** :9200/indexpattern*/ -u username:pwd

```

If i am adding a \* after index pattern name it returns a status code of 200 even if the pattern does not exist. and if i remove the star it returns 404 even if the pattern exists. the index patterns are have timestamp appended after their names so i tried using a \*

---

<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:** [December 19, 2022, 9:25am UTC](https://discuss.elastic.co/t/check-if-index-pattern-exists-using-curl/319408/2 "2022-12-19T09:25:35Z")

</div>

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