protected bool PutIndexTemplate()

in src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelBase.Bootstrap.cs [106:118]


	protected bool PutIndexTemplate(BootstrapMethod bootstrapMethod, string name, string body)
	{
		var putIndexTemplateResponse = Options.Transport.Request<PutIndexTemplateResponse>
			(HttpMethod.PUT, $"_index_template/{name}", PostData.String(body));
		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
			);
	}