Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

fix: Don't set include_type_name query param for ES v7 template creation call #519

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,17 @@ public void RegisterTemplateIfNeeded()
}
}

StringResponse result;
if (_versionManager.EffectiveVersion.Major < 8)
{
result = _client.Indices.PutTemplateForAll<StringResponse>(_templateName, GetTemplatePostData(),
var result = _versionManager.EffectiveVersion.Major switch
{
< 7 => _client.Indices.PutTemplateForAll<StringResponse>(_templateName, GetTemplatePostData(),
new PutIndexTemplateRequestParameters
{
IncludeTypeName = IncludeTypeName ? true : (bool?)null
});
}
else
{
}),
< 8 => _client.Indices.PutTemplateForAll<StringResponse>(_templateName, GetTemplatePostData()),
// Default to version 8 API
result = _client.Indices.PutTemplateV2ForAll<StringResponse>(_templateName, GetTemplatePostData());
}
_ => _client.Indices.PutTemplateV2ForAll<StringResponse>(_templateName, GetTemplatePostData()),
};

if (!result.Success)
{
Expand Down