# Hit.sort() method contract cnanges

**URL:** <https://discuss.elastic.co/t/hit-sort-method-contract-cnanges/366686>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 17, 2024, 4:14pm UTC](https://discuss.elastic.co/t/hit-sort-method-contract-cnanges/366686 "2024-09-17T16:14:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![surkovoleg2010](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/surkovoleg2010/32/112272_2.png) [@surkovoleg2010](https://discuss.elastic.co/u/surkovoleg2010)\
**Post date:** [September 17, 2024, 4:14pm UTC](https://discuss.elastic.co/t/hit-sort-method-contract-cnanges/366686/1 "2024-09-17T16:14:07Z")

</div>

Hello, we use elasticsearch-java client version 8.4.3. after upgrading to 8.13.4 we found that the contract for Hit.sort method changed (returns `List<FieldValue>` instead of `List<String>)`.

could you suggest please how to use it now without changing the contract for our clients (they send us `List<String>` for searchAfter functionality and we also return them `List<String>`).  
Can the `_toJsonString` method be used for it?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [September 23, 2024, 3:31pm UTC](https://discuss.elastic.co/t/hit-sort-method-contract-cnanges/366686/2 "2024-09-23T15:31:19Z")

</div>

Hello! Correct, `_toJsonString` will convert whatever type is found in the `value` field or FieldValue to String.
