code: public static TermsSet newTermsSet(long expectedElements, TermsByQueryRequest.TermsEncoding termsEncoding, CircuitBreaker breaker) {
      switch (termsEncoding) {
        case LONG:
          return new LongTermsSet(expectedElements, breaker);
        case INTEGER:
          return new IntegerTermsSet(expectedElements, breaker);
        case BLOOM:
          return new BloomFilterTermsSet(expectedElements, breaker);
        case BYTES:
          return new BytesRefTermsSet(breaker);
        default:
          throw new IllegalArgumentException("[termsByQuery] Invalid terms encoding: " + termsEncoding.name());
      }
    }
docs: Used by {@link solutions.siren.join.action.terms.TransportTermsByQueryAction}