Elasticsearch NEST 多搜索 ArgumentNullException
Elasticsearch NEST MultiSearch ArgumentNullException
当我尝试使用 NEST 文档中的一个非常简单的 MultiSearch 运算符示例时:
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);
然后我有以下错误:
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)
但只有当我使用 Object Initializer Syntax 时 - 当我使用 Fluent Syntax 时:
var result2 = _client.MultiSearch(ms => ms
.Search<MyClass>("esproj", s => s.MatchAll())
.Search<MyClass>("people", s => s.MatchAll())
);
一切正常(我得到结果)。我的 Nest 客户端版本是 1.4.2。
我做错了什么?
这绝对是一个错误。刚刚打开 https://github.com/elastic/elasticsearch-net/issues/127 并将在下一个版本中解决此问题。
当我尝试使用 NEST 文档中的一个非常简单的 MultiSearch 运算符示例时:
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);
然后我有以下错误:
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)
但只有当我使用 Object Initializer Syntax 时 - 当我使用 Fluent Syntax 时:
var result2 = _client.MultiSearch(ms => ms
.Search<MyClass>("esproj", s => s.MatchAll())
.Search<MyClass>("people", s => s.MatchAll())
);
一切正常(我得到结果)。我的 Nest 客户端版本是 1.4.2。 我做错了什么?
这绝对是一个错误。刚刚打开 https://github.com/elastic/elasticsearch-net/issues/127 并将在下一个版本中解决此问题。