Check if an ingest pipeline exists


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-
# 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


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?

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