serilog-sinks-elasticsearch
serilog-sinks-elasticsearch copied to clipboard
Add autogenerated template IndexAliases configuration properties
Does this issue relate to a new feature or an existing bug?
- [ ] Bug
- [x] New Feature
What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package. Serilog.Sinks.Elasticsearch 9.0.0
What is the target framework and operating system? See target frameworks & net standard matrix.
- [x] .net 6
Please describe the current behavior? Current configuration for AutoRegisterTemplate in ElasticsearchTemplateProvider allows adding only list of alias names. And there is no way to set properties for autogenerated template aliases. As properties are set to an empty object
ElasticsearchTemplateProvider.cs
//If index alias or aliases are specified
if (options.IndexAliases?.Length > 0)
foreach (var alias in options.IndexAliases)
{
//Added blank object for alias to make look like this in JSON:
//"alias_1" : {}
aliases.Add(alias, new object());
}
Please describe the expected behavior? Change IndexAliases configuration so the properties like "is_write_index" can be set. Elastic aliases
If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
I m open for PRs, although this looks like it can be a breaking change. Not a big issue as long as we bump the version and have a changelog. Would you mind working this out?
I ended up using low level client to achieve this. In a foreseeable future I won't be able to implement this myself, if at some point I'll have a free time I'll pick it up if no one else does.