# Illegal\_argument\_exception when searching with scroll in new elasticserach java client

**URL:** <https://discuss.elastic.co/t/illegal-argument-exception-when-searching-with-scroll-in-new-elasticserach-java-client/310970>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 29, 2022, 9:25am UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-searching-with-scroll-in-new-elasticserach-java-client/310970 "2022-07-29T09:25:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALX\_DM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alx_dm/32/106314_2.png) [@ALX\_DM](https://discuss.elastic.co/u/ALX_DM)\
**Post date:** [July 29, 2022, 9:25am UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-searching-with-scroll-in-new-elasticserach-java-client/310970/1 "2022-07-29T09:25:33Z")

</div>

What is the correct syntax when building a search request with scroll.

I did this but I get an exception

```auto
    final co.elastic.clients.elasticsearch.core.SearchRequest req =
        rbuilder
            .index(indexPref)
            .scroll(t -> t.time("60000"))
            .build();

```

I got the following error:

```auto
[es/search] failed: [illegal_argument_exception] failed to parse setting [scroll] with value [60000] as a time value: unit is missing or unrecognized

```

Unit should be milliseconds, but I dont where to put it.

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [July 29, 2022, 11:41am UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-searching-with-scroll-in-new-elasticserach-java-client/310970/2 "2022-07-29T11:41:59Z")

</div>

Hi @ALX_DM

You should follow the [Time Unit](https://www.elastic.co/guide/en/elasticsearch/reference/current/api-conventions.html#time-units) convention.

In your code replace "60000" with "60000s", if the scale is in seconds.

---

<div class="post-metadata">

**Author:** ![ALX\_DM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alx_dm/32/106314_2.png) [@ALX\_DM](https://discuss.elastic.co/u/ALX_DM)\
**Post date:** [July 29, 2022, 5:02pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-searching-with-scroll-in-new-elasticserach-java-client/310970/3 "2022-07-29T17:02:54Z")

</div>

@RabBit_BR

Thank you!

Much appreciated! 🍻

---

<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 26, 2022, 5:02pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-searching-with-scroll-in-new-elasticserach-java-client/310970/4 "2022-08-26T17:02:59Z")

</div>

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