Skip to content

Commit fde4409

Browse files
committed
Adding nullcheck and use Self.Types
1 parent 9822b5b commit fde4409

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Nest/DSL/IndicesStatsDescriptor.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public partial class IndicesStatsDescriptor : IndicesOptionalPathDescriptor<Indi
5353
//<summary>A comma-separated list of fields for `completion` metric (supports wildcards)</summary>
5454
public IndicesStatsDescriptor Types(params TypeNameMarker[] completion_fields)
5555
{
56-
((IIndicesStatsRequest)this).Types = completion_fields;
56+
Self.Types = completion_fields;
5757
return this;
5858
}
5959

@@ -65,12 +65,14 @@ public IndicesStatsDescriptor Metrics(params IndicesStatsMetric[] metrics)
6565

6666
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<IndicesStatsRequestParameters> pathInfo)
6767
{
68-
var types = ((IIndicesStatsRequest)this).Types;
69-
var typeNameMarkers = types as TypeNameMarker[] ?? types.ToArray();
70-
if (typeNameMarkers.HasAny())
68+
if (Self.Types != null)
7169
{
72-
var inferrer = new ElasticInferrer(settings);
73-
pathInfo.RequestParameters.AddQueryString("types", inferrer.TypeNames(typeNameMarkers));
70+
var typeNameMarkers = Self.Types as TypeNameMarker[] ?? Self.Types.ToArray();
71+
if (typeNameMarkers.HasAny())
72+
{
73+
var inferrer = new ElasticInferrer(settings);
74+
pathInfo.RequestParameters.AddQueryString("types", inferrer.TypeNames(typeNameMarkers));
75+
}
7476
}
7577
IndicesStatsPathInfo.Update(settings, pathInfo, this);
7678
}

0 commit comments

Comments
 (0)