Null Values Ignred by Elasticsearch

We are using the NEST library with Elasticsearch versions 7.14.
Lets say we have assigned a field a value of "hello World".
The filed is mapped as a Keyword type and Not Indexed.

If you update that document using the Update API with the same field having a null value, Elasticsearch ignores that assignement and keeps what was originally there i.e. "Hello World". In order to get rid of the fields value you have to assign it something like an empty string which classes in .NET with string properties normally have a default value of NULL.

So when a user updates a field by removing its value in the UI, the index does not take that change and keeps the old value.

So you actually have a completely different data in the index than what you think you have after an update.

You should remove the field from the document in Elasticsearch, instead of setting it to null.

Hi
But we need that field for other documents where the value is not null. And even that record itself may have an actual value in the future. It has to stay in the mapping and the index.
Is this behavior of rejecting null values in an existing field correct? As I mentioned, users who remove the value in the UI, the update fails leaving inconsistent data.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.