When I try to use a very simple example of MultiSearch operator from NEST documentation:
var request = new MultiSearchRequest
{
Operations = new Dictionary<string, ISearchRequest>
{
{ "esproj", new SearchRequest
{
Query = new QueryContainer(new MatchAllQuery())
}
},
{ "people", new SearchRequest
{
Query = new QueryContainer(new MatchAllQuery())
}
}
}
};
var result = _client.MultiSearch(request);
then I have the following error:
System.ArgumentNullException was unhandled by user code HResult=-2147467261 Source=mscorlib StackTrace: in System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation) in Nest.Resolvers.Converters.MultiSearchConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) w C:\code\elasticsearch-net\src\Nest\Resolvers\Converters\MultiSearchConverter.cs:row 101 in Nest.Resolvers.Converters.MultiSearchConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) w C:\code\elasticsearch-net\src\Nest\Resolvers\Converters\MultiSearchConverter.cs:row 78 in Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) in Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
But only if I use Object Initializer Syntax - when I use Fluent Syntax:
var result2 = _client.MultiSearch(ms => ms
.Search<MyClass>("esproj", s => s.MatchAll())
.Search<MyClass>("people", s => s.MatchAll())
);
everything is OK (I get results). Version of my Nest client is 1.4.2. What am I doing wrong?