# How to check if an index exists over HTTP?

**URL:** <https://discuss.elastic.co/t/how-to-check-if-an-index-exists-over-http/4935>\
**Category:** Elasticsearch\
**Created:** [July 23, 2011, 7:14pm UTC](https://discuss.elastic.co/t/how-to-check-if-an-index-exists-over-http/4935 "2011-07-23T19:14:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajsie](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@ajsie](https://discuss.elastic.co/u/ajsie)\
**Post date:** [July 23, 2011, 7:14pm UTC](https://discuss.elastic.co/t/how-to-check-if-an-index-exists-over-http/4935/1 "2011-07-23T19:14:20Z")

</div>

I wanna create a new index if it doesn't already exist.

How can I check that?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 25, 2011, 5:20am UTC](https://discuss.elastic.co/t/how-to-check-if-an-index-exists-over-http/4935/2 "2011-07-25T05:20:40Z")

</div>

You can use `curl -XHEAD localhost:9200/test` where test is the name of the  
index. It will return 404 status if it does not exists, and 200 if it does.

On Sat, Jul 23, 2011 at 10:14 PM, johnnywengluu  
[johnny.weng.luu@gmail.com](mailto:johnny.weng.luu@gmail.com)wrote:

> I wanna create a new index if it doesn't already exist.
> 
> How can I check that?
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/How-to-check-if-an-index-exists-over-HTTP-tp3194041p3194041.html](http://elasticsearch-users.115913.n3.nabble.com/How-to-check-if-an-index-exists-over-HTTP-tp3194041p3194041.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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 6, 2017, 3:59am UTC](https://discuss.elastic.co/t/how-to-check-if-an-index-exists-over-http/4935/3 "2017-07-06T03:59:39Z")

</div>


