# Elasticsearch Java API Client throwing error for empty fields

**URL:** <https://discuss.elastic.co/t/elasticsearch-java-api-client-throwing-error-for-empty-fields/337221>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 29, 2023, 2:50pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-throwing-error-for-empty-fields/337221 "2023-06-29T14:50:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shakhzod\_Khashimov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shakhzod_khashimov/32/122852_2.png) [@Shakhzod\_Khashimov](https://discuss.elastic.co/u/Shakhzod_Khashimov)\
**Post date:** [June 29, 2023, 2:50pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-throwing-error-for-empty-fields/337221/1 "2023-06-29T14:50:26Z")

</div>

Hi, we changed our elasticsearch from RestHighLevelClient to ElasticsearchClient, our document can have empty values, but in new Elasticsearch Java API Client it is throwing error saying:  
`org.springframework.data.elasticsearch.core.convert.ConversionException: Unable to convert value '' to java.time.LocalDate for property 'dataSconfino'`

I tried to add `@JsonInclude(JsonInclude.Include.NON_EMPTY)` but it didn't help,

how we can set some fields as optional, so that they can be also empty in elasticsearch java api client?

---

<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:** [July 27, 2023, 2:50pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-client-throwing-error-for-empty-fields/337221/2 "2023-07-27T14:50:32Z")

</div>

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