code: @Override
    public void writeTo(StreamOutput out) throws IOException {
      try {
        super.writeTo(out);
        // Encode type of encoding
        out.writeVInt(termsSet.getEncoding().ordinal());
        // Encode terms
        termsSet.writeTo(out);
      }
      finally {
        // Releases the resources and adjust the circuit breaker
        termsSet.release();
      }
    }
docs: Serialize and release the terms set.
  <p>
  If the response is sent through a {@link org.elasticsearch.transport.TransportService.DirectResponseChannel},
  this method will not be called and the {@link #termsSet} will be released by the receiver, i.e.,
  {@link TransportTermsByQueryAction#newResponse(TermsByQueryRequest, AtomicReferenceArray, ClusterState)}.