feat: Add support for EnableApiVersioningHeader option for servers v8+ #156
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have upgraded Elastic server to version 8.1.3 and experienced errors. After reading https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.17/connecting-to-elasticsearch-v8.html#enabling-compatibility-mode and elastic/elasticsearch-net#6154 we tried setting the ELASTIC_CLIENT_APIVERSIONING environment variable which fixed it.
One of our applications, though, connects to two different Elastic servers, one for logging and one for a search index. The search index server is on version 7.10 which does not yet support ApiVersioningHeader, and we cannot upgrade it yet. Thus we need NLog target to run with EnableApiVersioningHeader and the other client without.
This PR adds support for enabling ApiVersioningHeader just for the NLog target from config.
A limitation is, that it will not work when enabling it for servers running <7.13 (as per elastic/elasticsearch-net#6154 (comment)) but I think that could be adequately explained in documentation.
Checklist