protected async Task PutIndexTemplateAsync()

in src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelBase.Bootstrap.cs [121:134]


	protected async Task<bool> PutIndexTemplateAsync(BootstrapMethod bootstrapMethod, string name, string body, CancellationToken ctx = default)
	{
		var putIndexTemplateResponse = await Options.Transport.RequestAsync<PutIndexTemplateResponse>
				(HttpMethod.PUT, $"_index_template/{name}", PostData.String(body), cancellationToken: ctx)
			.ConfigureAwait(false);
		if (putIndexTemplateResponse.ApiCallDetails.HasSuccessfulStatusCode) return true;

		return bootstrapMethod == BootstrapMethod.Silent
			? false
			: throw new Exception(
				$"Failure to create index templates for {TemplateWildcard}: {putIndexTemplateResponse}",
				putIndexTemplateResponse.ApiCallDetails.OriginalException
			);
	}