1212import org .apache .lucene .document .InetAddressPoint ;
1313import org .apache .lucene .util .BytesRef ;
1414import org .elasticsearch .TransportVersions ;
15+ import org .elasticsearch .common .io .stream .DelayableWriteable ;
1516import org .elasticsearch .common .io .stream .NamedWriteable ;
1617import org .elasticsearch .common .io .stream .StreamInput ;
1718import org .elasticsearch .common .io .stream .StreamOutput ;
@@ -260,7 +261,7 @@ private DateTime(DateFormatter formatter, ZoneId timeZone, DateFieldMapper.Resol
260261 this .formatSortValues = formatSortValues ;
261262 }
262263
263- public DateTime (StreamInput in ) throws IOException {
264+ private DateTime (StreamInput in ) throws IOException {
264265 String formatterPattern = in .readString ();
265266 Locale locale = in .getTransportVersion ().onOrAfter (TransportVersions .DATE_TIME_DOC_VALUES_LOCALES )
266267 ? LocaleUtils .parse (in .readString ())
@@ -285,6 +286,14 @@ public String getWriteableName() {
285286 return NAME ;
286287 }
287288
289+ public static DateTime readFrom (StreamInput in ) throws IOException {
290+ final DateTime dateTime = new DateTime (in );
291+ if (in instanceof DelayableWriteable .Deduplicator d ) {
292+ return d .deduplicate (dateTime );
293+ }
294+ return dateTime ;
295+ }
296+
288297 @ Override
289298 public void writeTo (StreamOutput out ) throws IOException {
290299 out .writeString (formatter .pattern ());
@@ -528,7 +537,7 @@ public Decimal(String pattern) {
528537 this .format = new DecimalFormat (pattern , SYMBOLS );
529538 }
530539
531- public Decimal (StreamInput in ) throws IOException {
540+ private Decimal (StreamInput in ) throws IOException {
532541 this (in .readString ());
533542 }
534543
@@ -537,6 +546,14 @@ public String getWriteableName() {
537546 return NAME ;
538547 }
539548
549+ public static Decimal readFrom (StreamInput in ) throws IOException {
550+ final Decimal decimal = new Decimal (in );
551+ if (in instanceof DelayableWriteable .Deduplicator d ) {
552+ return d .deduplicate (decimal );
553+ }
554+ return decimal ;
555+ }
556+
540557 @ Override
541558 public void writeTo (StreamOutput out ) throws IOException {
542559 out .writeString (pattern );
0 commit comments