Skip to content

Commit f496617

Browse files
committed
Convenience extensions for template exists
Closes #1280
1 parent 87c4d43 commit f496617

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Nest/ConvenienceExtensions/ExistsExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,14 @@ public static Task<IExistsResponse> AliasExistsAsync(this IElasticClient client,
3838
return client.AliasExistsAsync(new AliasExistsRequest(indexName, aliasName));
3939
}
4040

41+
public static IExistsResponse TemplateExists(this IElasticClient client, string templateName)
42+
{
43+
return client.TemplateExists(new TemplateExistsRequest(templateName));
44+
}
45+
46+
public static Task<IExistsResponse> TemplateExistsAsync(this IElasticClient client, string templateName)
47+
{
48+
return client.TemplateExistsAsync(new TemplateExistsRequest(templateName));
49+
}
4150
}
4251
}

src/Tests/Nest.Tests.Integration/Indices/IndicesTemplateTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public void TemplateExistsReturnsNoFalsePositives()
4545
});
4646
putResponse.IsValid.Should().BeTrue();
4747

48-
var falseExists = this.Client.TemplateExists(new TemplateExistsRequest("hello-world-blah"));
48+
var falseExists = this.Client.TemplateExists("hello-world-blah");
4949
falseExists.IsValid.Should().BeTrue();
5050
falseExists.Exists.Should().BeFalse();
5151

52-
var realExists = this.Client.TemplateExists(new TemplateExistsRequest(name));
52+
var realExists = this.Client.TemplateExists(name);
5353
realExists.Exists.Should().BeTrue();
5454
}
5555

0 commit comments

Comments
 (0)