# Problem to check if an Index Exist using NEST .Net

**URL:** <https://discuss.elastic.co/t/problem-to-check-if-an-index-exist-using-nest-net/140392>\
**Category:** Elasticsearch\
**Created:** [July 17, 2018, 8:06pm UTC](https://discuss.elastic.co/t/problem-to-check-if-an-index-exist-using-nest-net/140392 "2018-07-17T20:06:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![r1go](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r1go/32/30491_2.png) [@r1go](https://discuss.elastic.co/u/r1go)\
**Post date:** [July 17, 2018, 8:06pm UTC](https://discuss.elastic.co/t/problem-to-check-if-an-index-exist-using-nest-net/140392/1 "2018-07-17T20:06:28Z")

</div>

Hi there!,  
Im just trying to check if an index exist previous my query with something like that:

var request = new IndexExistsRequest("my\_beautiful\_index");  
var result = client.IndexExists(request);

But i always get the same response, **even with existing indexes**.

> "Invalid NEST response built from a unsuccessful low level call on HEAD:  
> /my\_beautiful\_index\r\n# Audit trail of this API call:
> 
> [1] BadResponse: Node: [http://bla](http://bla) bla bla@bla bla bla/  
> Took: 00:00:00.1330788\r\n# OriginalException: System.Net.WebException:  
> The remote server returned an error: (403) Forbidden.\r\n  
> at System.Net.HttpWebRequest.GetResponse()\r\n  
> at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData)\r\n#  
> Request:\r\n
> 
> Request stream not captured or already read to completion by serializer.  
> Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.\>

and my lovely configuration its something like that:

var settings = new ConnectionSettings(node);  
settings.DefaultIndex(another\_lovely\_index\_overhere);  
settings.DisableDirectStreaming();

var client = new ElasticClient(settings);

any thoughts? Thanks in advance 😀

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [July 18, 2018, 7:58am UTC](https://discuss.elastic.co/t/problem-to-check-if-an-index-exist-using-nest-net/140392/2 "2018-07-18T07:58:03Z")

</div>

> [@r1go](#):
>
> The remote server returned an error: (403) Forbidden.

It looks like you either have some kind or auth or proxy in front of Elasticsearch, or are using X-Pack Security with anonymous access and do not have authorization to check if that index exists.

---

<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:** [August 15, 2018, 7:58am UTC](https://discuss.elastic.co/t/problem-to-check-if-an-index-exist-using-nest-net/140392/3 "2018-08-15T07:58:10Z")

</div>

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