diff --git a/docs/build/nest/core/multi-search.html b/docs/build/nest/core/multi-search.html index 357317621f6..1fe23d51dff 100644 --- a/docs/build/nest/core/multi-search.html +++ b/docs/build/nest/core/multi-search.html @@ -3,7 +3,7 @@
The multi search API allows to execute several search requests within the same API.
var result = client.MultiSearch(ms => ms
- .Search<ElasticsearchProject>("esproj", s => s.MatchAll())
+ .Search<ElasticsearchProject>("projects", s => s.MatchAll())
.Search<Person>("people", s => s.MatchAll())
);
MultiSearch returns an IMultiSearchResponse object. Each SearchResponse<T> can be retrieved using the corresponding name that was specified in the request.
// returns a SearchResponse<ElasticsearchProject>>
-var projects = result.GetResponse<ElasticsearchProject>("esproj");
+var projects = result.GetResponse<ElasticsearchProject>("projects");
// returns a SearchResponse<Person>>
var people = result.GetResponse<Person>("people");
diff --git a/docs/contents/nest/core/multi-search.markdown b/docs/contents/nest/core/multi-search.markdown
index c0a6b38f329..0213fb7b5a6 100644
--- a/docs/contents/nest/core/multi-search.markdown
+++ b/docs/contents/nest/core/multi-search.markdown
@@ -13,7 +13,7 @@ The multi search API allows to execute several search requests within the same A
### Fluent Syntax
var result = client.MultiSearch(ms => ms
- .Search("esproj", s => s.MatchAll())
+ .Search("projects", s => s.MatchAll())
.Search("people", s => s.MatchAll())
);
@@ -24,12 +24,12 @@ The multi search API allows to execute several search requests within the same A
{
Operations = new Dictionary
{
- { "esproj", new SearchRequest
+ { "projects", new SearchRequest
{
Query = new QueryContainer(new MatchAllQuery())
}
},
- { "people", new SearchRequest
+ { "people", new SearchRequest
{
Query = new QueryContainer(new MatchAllQuery())
}
@@ -44,7 +44,7 @@ The multi search API allows to execute several search requests within the same A
`MultiSearch` returns an `IMultiSearchResponse` object. Each `SearchResponse` can be retrieved using the corresponding name that was specified in the request.
// returns a SearchResponse>
- var projects = result.GetResponse("esproj");
+ var projects = result.GetResponse("projects");
// returns a SearchResponse>
var people = result.GetResponse("people");
diff --git a/src/Nest/Resolvers/Converters/MultiSearchConverter.cs b/src/Nest/Resolvers/Converters/MultiSearchConverter.cs
index 47a7920ff17..d8e9c33542f 100644
--- a/src/Nest/Resolvers/Converters/MultiSearchConverter.cs
+++ b/src/Nest/Resolvers/Converters/MultiSearchConverter.cs
@@ -96,7 +96,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
{
var descriptor = m.Descriptor.Value;
var concreteTypeSelector = descriptor.TypeSelector;
- var baseType = m.Descriptor.Value.ClrType;
+ var baseType = m.Descriptor.Value.ClrType ?? typeof(object);
var generic = MakeDelegateMethodInfo.MakeGenericMethod(baseType);
diff --git a/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj b/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj
index ce6743c2e9f..b89d1606a64 100644
--- a/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj
+++ b/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj
@@ -178,6 +178,7 @@
+
diff --git a/src/Tests/Nest.Tests.Integration/Reproduce/Reproduce1279Tests.cs b/src/Tests/Nest.Tests.Integration/Reproduce/Reproduce1279Tests.cs
new file mode 100644
index 00000000000..1fac4bb30f4
--- /dev/null
+++ b/src/Tests/Nest.Tests.Integration/Reproduce/Reproduce1279Tests.cs
@@ -0,0 +1,40 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FluentAssertions;
+using Nest.Tests.MockData.Domain;
+using Newtonsoft.Json.Linq;
+
+namespace Nest.Tests.Integration.Reproduce
+{
+ [TestFixture]
+ public class Reproduce1279Tests : IntegrationTests
+ {
+ [Test]
+ public void MultiSearchNullArgumentException()
+ {
+ var request = new MultiSearchRequest
+ {
+ Operations = new Dictionary
+ {
+ { "test", new SearchRequest
+ {
+ Query = new QueryContainer(new MatchAllQuery()),
+ Types = new TypeNameMarker[] { typeof(Product), typeof(ElasticsearchProject) },
+ TypeSelector = (o, h) => typeof(ElasticsearchProject)
+ }
+ }
+ }
+ };
+
+ var result = Client.MultiSearch(request);
+ result.IsValid.Should().BeTrue();
+ var response = result.GetResponse