Migrating from Nest to Elasticsearch V8
Before (using Nest) I had
var settings = new ConnectionSettings(new Uri(elasticSettings.Uri));
settings
.ThrowExceptions(elasticSettings.ThrowExceptions)
.PrettyJson(elasticSettings.PrettyJson)
.DefaultMappingFor<CorrelationContext>(ms => ms.Ignore(p => p.DgpHeader));
Changed ConnectionSettings
to ElasticsearchClientSettings
but the Ignore-option on DefaultMappingFor
isn't available anymore.
I only find documentation regarding this for v7 but not for v8
Is it moved to somewhere else? And if not, how can we achieve the same result?
Update:
After looking further in the documentation I came across the page regarding serialization.
However, I do not have access to the class-code to add the JsonIgnore
attribute (class is in other library).
Couldn't find way to do it through settings so ended up creating a new POCO with the exact same name and properties as the original class (obviously without the one property I want to ignore).