Description
NEST/Elasticsearch.net Version 7.12.1
Elasticsearch Version 7.12.1
(Note: Worked previously in Version 7.3.2)
When trying to delete a watcher using the following request:
elasticConnection.Client.Watcher.Delete("someWatcherID");
I get the following error:
Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (400) Bad Request.. Call: Status code 400 from: DELETE /_watcher/watch/someWatcherID. ServerError: Type: illegal_argument_exception Reason: "request [DELETE /_watcher/watch/someWatcherID] does not support having a body" ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData)
--- End of inner exception stack trace ---
at Elasticsearch.Net.Transport`1.HandleElasticsearchClientException(RequestData data, Exception clientException, IElasticsearchResponse response)
at Elasticsearch.Net.Transport`1.FinalizeResponse[TResponse](RequestData requestData, IRequestPipeline pipeline, List`1 seenExceptions, TResponse response)
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)
at Nest.Specification.WatcherApi.WatcherNamespace.Delete(Id id, Func`2 selector)
Note that a similar error occurs when trying to delete a document from a standard index (not ".watches").
When calling:
elasticConnection.Client
.Delete<ElasticWatcher>(watcher.Id, de => de
.Index("watcherdata")
.Refresh(Refresh.True)
);
it also results in the same error:
Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (400) Bad Request.. Call: Status code 400 from: DELETE /watcherdata/_doc/77f1ce4d-4d6a-ec2d-42e9-e886a41473b2?refresh=true. ServerError: Type: illegal_argument_exception Reason: "request [DELETE /watcherdata/_doc/77f1ce4d-4d6a-ec2d-42e9-e886a41473b2] does not support having a body" ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData)
--- End of inner exception stack trace ---
at Elasticsearch.Net.Transport`1.HandleElasticsearchClientException(RequestData data, Exception clientException, IElasticsearchResponse response)
at Elasticsearch.Net.Transport`1.FinalizeResponse[TResponse](RequestData requestData, IRequestPipeline pipeline, List`1 seenExceptions, TResponse response)
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)
at Nest.ElasticClient.Delete[TDocument](DocumentPath`1 id, Func`2 selector)
Note that I can delete the watcher/documents using the low-level client as follows:
elasticConnection.Client.LowLevel.Watcher.Delete<DeleteWatchResponse>("someWatcherID");
This works without problem.
Is intended to only work with the low-level client? Because in version 7.3.2 it worked with the high-level client.
Or alternatively, I can also delete the watcher using a _delete_by_query
call on the '.watches' index, but I read that deleting watchers should only be done using the DELETE _watcher/watch/
call.
I also created a post on Discuss.Elastic about this issue.