diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java b/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java index 0ab2342d78..e0e97be8b0 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java @@ -37,6 +37,8 @@ import jakarta.json.stream.JsonParser; import java.io.StringReader; import java.io.StringWriter; +import java.math.BigDecimal; +import java.math.BigInteger; class JsonDataImpl implements JsonData { private final Object value; @@ -111,10 +113,22 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.write((JsonValue) value); } else if (value instanceof String) { generator.write((String) value); + } else if (value instanceof BigDecimal) { + generator.write((BigDecimal) value); + } else if (value instanceof BigInteger) { + generator.write((BigInteger) value); + } else if (value instanceof Short) { + generator.write((Short) value); } else if (value instanceof Integer) { generator.write((Integer) value); + } else if (value instanceof Long) { + generator.write((Long) value); + } else if (value instanceof Float) { + generator.write((Float) value); } else if (value instanceof Double) { generator.write((Double) value); + } else if (value instanceof Boolean) { + generator.write((Boolean) value); } else { // Mapper provided at creation time has precedence (this.mapper != null ? this.mapper : mapper).serialize(value, generator);