
Description
Hello,
When I try to get a watch using NEST (5.5.0), I get an exception with a "must" object array in the watcher input query like "query": {"bool": {"must": [{}, {}...]}}
:
Elasticsearch.Net.UnexpectedElasticsearchClientException : 'Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path 'watch.input.search.request.body.query.bool.must[0].match.Type', line 1, position 500.'
Same kind of exception with a single "must" object like "query": {"bool": {"must": {}}}
:
Elasticsearch.Net.UnexpectedElasticsearchClientException : 'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.IEnumerable`1[Nest.QueryContainer]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'watch.input.search.request.body.query.bool.must.match', line 1, position 477.'
If I try to get the same watch using a "match_all": {}
query in the input, there is no error and I can get it.
I'm using a minimal code for testing, inside a .Net Standard 1.6 project (NEST referenced with NuGet):
private readonly ElasticClient _client;
public WatchesRepository()
{
var settings = new ConnectionSettings(new Uri("https://xxx"));
settings.BasicAuthentication("xxx", "xxx");
_client = new ElasticClient(settings);
}
public Watch GetWatch(string watchName)
{
var watchResponse = _client.GetWatch(watchName);
return watchResponse.Watch;
}
Is there a documantation for the xPack (especially for Watcher) part of the NEST package ?