# Java Client API: FieldValue vs JsonData

**URL:** <https://discuss.elastic.co/t/java-client-api-fieldvalue-vs-jsondata/303476>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 28, 2022, 8:04am UTC](https://discuss.elastic.co/t/java-client-api-fieldvalue-vs-jsondata/303476 "2022-04-28T08:04:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbrunot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sbrunot/32/103222_2.png) [@sbrunot](https://discuss.elastic.co/u/sbrunot)\
**Post date:** [April 28, 2022, 8:04am UTC](https://discuss.elastic.co/t/java-client-api-fieldvalue-vs-jsondata/303476/1 "2022-04-28T08:04:32Z")

</div>

Hello,

with the new Java Client API, some queries takes a FieldValue parameter (exemple: term query) and some other takes a JsonData parameter (exemple: range queries).

One issue that I have with FieldValue parameters is that the builder does not accept an Object instance, while JsonData does with factory method JsonData.of(...)

Would it be possible to also use JsonData for term queries (and other queries that uses FieldValue instead of JsonData), maybe by adding a method jsonDataValue(JsonData v) to the FieldValue class ?

---

<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:** [May 26, 2022, 8:05am UTC](https://discuss.elastic.co/t/java-client-api-fieldvalue-vs-jsondata/303476/2 "2022-05-26T08:05:04Z")

</div>

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