c# - How to set NullValueHandling.Include JsonSerializerSettings in a NEST client via ModifyJsonSerializerSettings -
in c# application i'm doing
var settings = new connectionsettings(node); settings.modifyjsonserializersettings(new jsonserializersettings() { nullvaluehandling = nullvaluehandling.include }); var client = new elasticclient(settings); however not have effect, null fields not indexed in elasticsearch.
my goal set serializer include null fields in object. there other way this?
to null values stored/indexed in elasticsearch need modify mappings handle null values. according mapping core types documentation
when there (json) null value field, utilize null_value field value. defaults not adding field @ all.
which means if there null value field in document indexing, unless null_value set in mapping field, elasticsearch not add together field document. illustration of how set indexed field take null values illustration above documentation link. see message field...
{ "tweet" : { "properties" : { "user" : {"type" : "string", "index" : "not_analyzed"}, "message" : {"type" : "string", "null_value" : "na"}, "postdate" : {"type" : "date"}, "priority" : {"type" : "integer"}, "rank" : {"type" : "float"} } } } c# elasticsearch nest jsonserializer
No comments:
Post a Comment