# How to force null values with SpringBoot?

**URL:** <https://discuss.elastic.co/t/how-to-force-null-values-with-springboot/352096>\
**Category:** Elasticsearch\
**Created:** [January 30, 2024, 2:20pm UTC](https://discuss.elastic.co/t/how-to-force-null-values-with-springboot/352096 "2024-01-30T14:20:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bernard\_Le\_Menuet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bernard_le_menuet/32/131236_2.png) [@Bernard\_Le\_Menuet](https://discuss.elastic.co/u/Bernard_Le_Menuet)\
**Post date:** [January 30, 2024, 2:20pm UTC](https://discuss.elastic.co/t/how-to-force-null-values-with-springboot/352096/1 "2024-01-30T14:20:31Z")

</div>

Hello

I have a working API saving some null values in Elasticsearch. I need to keep that behaviour for existong consumers.

In order to do that with Spring Boot, I am using storeNullValue attribute on spring-data-elasticsearch Field annotation

```auto
    @JsonProperty(value = "descr")
    @Field(name = "descr", storeNullValue = true)
    private String description;

```

I recently upgraded from  
Spring Boot 2.6 using spring-data-elsaticsearch 4.3.3  
to  
Spring Boot 3.1 using spring-data-elsaticsearch 5.1

And none of the null values are displayed anymore.

I tried upon elastic 7.16.2 and 8.8, and get the same result.

Perhaps there is a way force this using elastic mapping ?  
I am not familiar with it.  
Note that I need a null value, not an empty string or a string containing 'null'

Thanks for your caring  
Bernard

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 27, 2024, 2:20pm UTC](https://discuss.elastic.co/t/how-to-force-null-values-with-springboot/352096/2 "2024-02-27T14:20:46Z")

</div>

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