# TimeValue - number\_format\_exception - Java client

**URL:** <https://discuss.elastic.co/t/timevalue-number-format-exception-java-client/279015>\
**Category:** Elasticsearch\
**Created:** [July 19, 2021, 5:58am UTC](https://discuss.elastic.co/t/timevalue-number-format-exception-java-client/279015 "2021-07-19T05:58:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leuteris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leuteris/32/89009_2.png) [@Leuteris](https://discuss.elastic.co/u/Leuteris)\
**Post date:** [July 19, 2021, 5:58am UTC](https://discuss.elastic.co/t/timevalue-number-format-exception-java-client/279015/1 "2021-07-19T05:58:43Z")

</div>

I have a search request using PointInTimeBuilder:

```auto
PointInTimeBuilder pointInTimeBuilder = new PointInTimeBuilder("id...");
pointInTimeBuilder.setKeepAlive(TimeValue.timeValueSeconds(66));

```

The keep\_alive value is 66 seconds. For some reason, ES java client converts it to:  
`"pit":{"id":"id...","keep_alive":"1.1m"}`

keep\_alive is converted to minutes. As a result, the following exception is thrown:

> Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=illegal\_argument\_exception, reason=failed to parse [1.1m], fractional time values are not supported]  
> at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:485)  
> at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:396)  
> at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:426)  
> ... 67 common frames omitted  
> Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=number\_format\_exception, reason=For input string: "1.1"]

Is this the expected behavior and why?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 19, 2021, 9:36am UTC](https://discuss.elastic.co/t/timevalue-number-format-exception-java-client/279015/2 "2021-07-19T09:36:43Z")

</div>

That looks like a bug due to parsing of the `TimeValue` object. As a workaround for now, you should use full minutes as the proper argument to keep alive. Something like `1m` or `2m`.

I will file an issue in the Elasticsearch repo about this.

**Update** : I opened [PointInTimeBuilder does not support all time values in keep alive timeout · Issue #75446 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/75446)

---

<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:** [August 16, 2021, 9:37am UTC](https://discuss.elastic.co/t/timevalue-number-format-exception-java-client/279015/3 "2021-08-16T09:37:09Z")

</div>

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