@Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeString(fieldName);
   out.writeGenericValue(value);
   type.writeTo(out);
   operator.writeTo(out);
   out.writeVInt(slop);
   out.writeVInt(prefixLength);
   out.writeVInt(maxExpansions);
   out.writeBoolean(fuzzyTranspositions);
   out.writeBoolean(lenient);
   zeroTermsQuery.writeTo(out);
   // optional fields
   out.writeOptionalString(analyzer);
   out.writeOptionalString(minimumShouldMatch);
   out.writeOptionalString(fuzzyRewrite);
   if (fuzziness == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     fuzziness.writeTo(out);
   }
   if (cutoffFrequency == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeFloat(cutoffFrequency);
   }
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   script.writeTo(out);
   ValueFormatterStreams.writeOptional(formatter, out);
   gapPolicy.writeTo(out);
   out.writeGenericValue(bucketsPathsMap);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   boolean hasScript = reduceScript != null;
   out.writeBoolean(hasScript);
   if (hasScript) {
     reduceScript.writeTo(out);
   }
   out.writeGenericValue(aggregation);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeString(this.fieldName);
   out.writeGenericValue(this.text);
   highFreqOperator.writeTo(out);
   lowFreqOperator.writeTo(out);
   out.writeOptionalString(analyzer);
   out.writeOptionalString(lowFreqMinimumShouldMatch);
   out.writeOptionalString(highFreqMinimumShouldMatch);
   out.writeBoolean(disableCoord);
   out.writeFloat(cutoffFrequency);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeString(fieldName);
   out.writeGenericValue(value);
 }