Int field is updated to 0 even though field already was set to !0 and field null is defined 0?


Hi all,

I'm using elastic 1.72 on Windows,
writing to the elastic with C# NEST client.

I defined a type "TcpPacket" with int field "SrcPort" with "null_value" to be 0.
The code inserts TcpPacket documents and updates those documents with extra concluded data.

I have a conceptual problem with updating the "SrcPort" int field, in example:
a. TcpPacket document is inserted with SrcPort=X (not 0).

b. Later, an update event occurs with new C# TcpPacket object where the SrcPort=0 (because I can't conclude the SrcPort with the new data). The updating algorithm:

  1. Find the original document elastic_id (the TcpPacket document still with SrcPort=X)

  2. Update the document with the elastic_id
    the code:
    _elasticClient.Update(descriptor => descriptor.Type(pocoObject.GetType()).Id(elasticID).Doc(pocoObject))

  3. Finish update process (Now the TcpPacket document had scrPort=0)

For other "null" values, where the field is string type for example, the original value is kept well.

Now, I know that dealing with Int is different than other types, but is there any configuration I can make so when the field updated value is 0, the original value will not be updated to 0 and stays the original value?


(system) #2