# Check if an ingest pipeline exists

**URL:** <https://discuss.elastic.co/t/check-if-an-ingest-pipeline-exists/104256>\
**Category:** Elasticsearch\
**Created:** [October 17, 2017, 1:59pm UTC](https://discuss.elastic.co/t/check-if-an-ingest-pipeline-exists/104256 "2017-10-17T13:59:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESCoder](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@ESCoder](https://discuss.elastic.co/u/ESCoder)\
**Post date:** [October 17, 2017, 1:59pm UTC](https://discuss.elastic.co/t/check-if-an-ingest-pipeline-exists/104256/1 "2017-10-17T13:59:43Z")

</div>

Hi,

I have a scenario where I have to create an ingest pipeline if it doesn't already exists.

So I issue a get pipeline call with the id to check if it already exists but it returns the following:

```
Invalid NEST response built from a unsuccessful low level call on GET: /_ingest/pipeline/Document-Processor-
Pipeline
# Audit trail of this API call:
- [1] SniffOnStartup: Took: 00:00:01.1748308
- [2] SniffSuccess: Node: http://localhost:9200/ Took: 00:00:01.1718426
- [3] PingSuccess: Node: http://localhost:9200/ Took: 00:00:00.0040141
- [4] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.0240171
# OriginalException: System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData)
# Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response:
{}

```

Is there any way I can check if a pipeline exists which wouldn't return an invalid response if it doesn't exists? or can I simply use PutPipeline method everytime instead of checking and adding the pipeline?

I'm using elastic search 5.1.2 and NEST 5.x

Note: I did set the DisableDirectStreaming() option on the connection settings but still I still get the above message

Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 17, 2017, 4:16pm UTC](https://discuss.elastic.co/t/check-if-an-ingest-pipeline-exists/104256/2 "2017-10-17T16:16:12Z")

</div>

`404` is a totally correct response IMO.  
It just says that the pipeline does not exist.

Can't you catch that `WebException` and get the error code and compare it to `404`?

---

<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:** [November 14, 2017, 4:16pm UTC](https://discuss.elastic.co/t/check-if-an-ingest-pipeline-exists/104256/3 "2017-11-14T16:16:18Z")

</div>

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