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

Setting NumberOfReplicas to 0 does not have any effect #239

Closed
ffMathy opened this issue Apr 30, 2019 · 6 comments
Closed

Setting NumberOfReplicas to 0 does not have any effect #239

ffMathy opened this issue Apr 30, 2019 · 6 comments

Comments

@ffMathy
Copy link
Contributor

ffMathy commented Apr 30, 2019

Setting NumberOfReplicas to 0 in the ElasticsearchSinkOptions does not work. Only if the value is higher.

0 should still be a valid value, and the value is also a nullable integer currently, so I think this is a bug.

@ffMathy ffMathy changed the title Setting NumberOfReplicas to 0 does not work Setting NumberOfReplicas to 0 does not have any effect Apr 30, 2019
@tresoldigiorgio
Copy link
Contributor

it woks for me with this settings:
{ "Name": "Elasticsearch", "Args": { "nodeUris": "http://localhost:9200", "indexFormat": "auditlog-{0:yyyy.MM}", "numberOfShards": 1, "numberOfReplicas": 0, "overwriteTemplate": true, "autoRegisterTemplate": true, "autoRegisterTemplateVersion": "ESv6", "numberOfShards": 1, "numberOfReplicas": 0 } }

@ffMathy
Copy link
Contributor Author

ffMathy commented Aug 28, 2019

Not via the ElasticsearchSinkOptions object. I'm not talking about JSON configuration.

@ffMathy
Copy link
Contributor Author

ffMathy commented Aug 28, 2019

Example:

loggerConfiguration.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(elasticsearchBaseUrl)
                {
                    Period = TimeSpan.FromSeconds(10),
                    NumberOfReplicas = 0,
                    NumberOfShards = 5,
                    BatchPostingLimit = 100,
                    AutoRegisterTemplate = true,
                    MinimumLogEventLevel = LogEventLevel.Verbose,
                    AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6,
                    CustomFormatter = new ExceptionAsObjectJsonFormatter(
                        renderMessage: true,
                        serializer: new JsonNetSerializer(
                            new LowLevelRequestResponseSerializer(),
                            new ConnectionSettings(elasticsearchBaseUrl),
                            modifyContractResolver: x =>
                                x.NamingStrategy = new CamelCaseNamingStrategy(),
                            jsonSerializerSettingsFactory: () =>
                                new JsonSerializerSettings
                                {
                                    TypeNameHandling = TypeNameHandling.None
                                }))
                })

The above will set number of replicas to 1.

@mivano
Copy link
Contributor

mivano commented Aug 29, 2019

Strange, 0 should be valid, but looks like it marks it as null and as such outputs the default value of 1. Care for a PR?

@ffMathy
Copy link
Contributor Author

ffMathy commented Aug 29, 2019

I don't have time unfortunately :(

@mivano
Copy link
Contributor

mivano commented Dec 16, 2019

See #301
Old issue, cleaning up. Still facing this issue, feel free to reopen.

@mivano mivano closed this as completed Dec 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants