Skip to content

Commit 168955b

Browse files
committed
Some fixes
Use the Inferrer on the Nest ConnectionSettings Ensure consistent HashCode for ManyIndices Use operation index/type in msearch when the request doesn't specify or when it's different from the request
1 parent 425b21c commit 168955b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Nest/CommonAbstractions/Infer/Indices/Indices.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ string IUrlParameter.GetString(IConnectionConfigurationValues settings)
5757
var nestSettings = settings as IConnectionSettingsValues;
5858
if (nestSettings == null)
5959
throw new Exception("Tried to pass field name on querysting but it could not be resolved because no nest settings are available");
60-
var infer = new Inferrer(nestSettings);
60+
61+
var infer = nestSettings.Inferrer;
6162
var indices = many.Indices.Select(i => infer.IndexName(i)).Distinct();
6263
return string.Join(",", indices);
6364
}
@@ -81,7 +82,7 @@ public override int GetHashCode()
8182
{
8283
return this.Match(
8384
all => "_all".GetHashCode(),
84-
many => string.Concat(many.Indices).GetHashCode()
85+
many => string.Concat(many.Indices.OrderBy(i => i.ToString())).GetHashCode()
8586
);
8687
}
8788
}

src/Nest/Search/MultiSearch/MultiSearchJsonConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
2222

2323
foreach (var operation in request.Operations.Values)
2424
{
25-
var indices = operation.Index != null
25+
var indices = request.Index == null || !request.Index.Equals(operation.Index)
2626
? operation.Index
27-
: request.Index;
27+
: null;
2828

29-
var types = operation.Type != null
29+
var types = request.Type == null || !request.Type.Equals(operation.Type)
3030
? operation.Type
31-
: request.Type;
31+
: null;
3232

3333
var searchType = operation.RequestParameters.GetQueryStringValue<SearchType>("search_type").GetStringValue();
3434
if (searchType == "query_then_fetch")

0 commit comments

Comments
 (0)