Skip to content

Commit 926a89d

Browse files
committed
Better error message when MultiGet or MultiGetFull are called with no ids
1 parent 52072aa commit 926a89d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Nest/ElasticClient-MultiGet.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ private ConnectionStatus _multiGetUsingDescriptor(Action<MultiGetDescriptor> mul
8686
multiGetSelector(descriptor);
8787
var data = @"{ ""docs"" : [";
8888
var objects = new List<string>();
89+
90+
descriptor._GetOperations.ThrowIfEmpty("MultiGetFull called but no get operations were specified");
91+
8992
foreach (var g in descriptor._GetOperations)
9093
{
9194
string objectJson = "{";
@@ -130,6 +133,8 @@ private ConnectionStatus _multiGetUsingDescriptor(Action<MultiGetDescriptor> mul
130133
private IEnumerable<T> MultiGet<T>(IEnumerable<string> ids, string path)
131134
where T : class
132135
{
136+
ids.ThrowIfEmpty("ids");
137+
133138
var data = @"{{ ""ids"": {0} }}".F(this.Serialize(ids));
134139
var response = this.Connection.PostSync(path + "_mget", data);
135140

0 commit comments

Comments
 (0)