You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The .toJsonString function throws a JsonException when a SearchRequest includes a query of type range.
Specifically, it shows the following error: Cannot find a serializer for type <type>. Consider using a full-featured JsonpMapper.
How can one reproduce the bug?
# Create a Query of type range
Query rangeQuery = Query.of(q -> q.range(r -> r
.field("time")
.format("strict_date_optional_time")
.gte(JsonData.of("2024-06-29T09:50:53Z"))
.lte(JsonData.of("2024-06-29T10:50:53Z"))));
# Add it as part of a boolQuery
BoolQuery boolQuery = BoolQuery.of(b -> b
.filter(rangeQuery));
# Add the boolQuery to the SearchRequest
SearchRequest searchRequest = new SearchRequest.Builder()
.query(q -> q.bool(boolQuery))
.build();
# Execute the toJsonString()
System.out.println("query: " + searchRequest.toJsonString());
What is the expected behavior?
The query should print without any issues.
Do you have any additional context?
Other types of query, such as matchPhrase seem to work correctly. However, when adding a query of type range, it throws the error.
I have been investigating the error, and it looks it's related to the parsing of the gte and lte elements. Although they are declared as JsonData types, the value is extracted as String (in this case), leading to the JsonException.
This, however, does not seem to affect the SearchRequest functionality, as I have been able to query sucessfully.
The text was updated successfully, but these errors were encountered:
What is the bug?
The
.toJsonString
function throws aJsonException
when aSearchRequest
includes a query of typerange
.Specifically, it shows the following error:
Cannot find a serializer for type <type>. Consider using a full-featured JsonpMapper.
How can one reproduce the bug?
What is the expected behavior?
The query should print without any issues.
Do you have any additional context?
Other types of query, such as
matchPhrase
seem to work correctly. However, when adding a query of type range, it throws the error.I have been investigating the error, and it looks it's related to the parsing of the
gte
andlte
elements. Although they are declared asJsonData
types, the value is extracted as String (in this case), leading to the JsonException.This, however, does not seem to affect the
SearchRequest
functionality, as I have been able to query sucessfully.The text was updated successfully, but these errors were encountered: