@Override
    public void postCollect() {
      final FixedBitSet allVisitedOrds = new FixedBitSet(maxOrd);
      for (long bucket = visitedOrds.size() - 1; bucket >= 0; --bucket) {
        final FixedBitSet bits = visitedOrds.get(bucket);
        if (bits != null) {
          allVisitedOrds.or(bits);
        }
      }

      final org.elasticsearch.common.hash.MurmurHash3.Hash128 hash =
          new org.elasticsearch.common.hash.MurmurHash3.Hash128();
      try (LongArray hashes = bigArrays.newLongArray(maxOrd, false)) {
        for (int ord = allVisitedOrds.nextSetBit(0);
            ord != -1;
            ord = ord + 1 < maxOrd ? allVisitedOrds.nextSetBit(ord + 1) : -1) {
          final BytesRef value = values.lookupOrd(ord);
          org.elasticsearch.common.hash.MurmurHash3.hash128(
              value.bytes, value.offset, value.length, 0, hash);
          hashes.set(ord, hash.h1);
        }

        for (long bucket = visitedOrds.size() - 1; bucket >= 0; --bucket) {
          final FixedBitSet bits = visitedOrds.get(bucket);
          if (bits != null) {
            for (int ord = bits.nextSetBit(0);
                ord != -1;
                ord = ord + 1 < maxOrd ? bits.nextSetBit(ord + 1) : -1) {
              counts.collect(bucket, hashes.get(ord));
            }
          }
        }
      }
    }
 @Override
 public long valueAt(int index) {
   final BytesRef bytes = values.valueAt(index);
   org.elasticsearch.common.hash.MurmurHash3.hash128(
       bytes.bytes, bytes.offset, bytes.length, 0, hash);
   return hash.h1;
 }
 @Override
 protected void innerParseCreateField(ParseContext context, List<Field> fields)
     throws IOException {
   final Object value;
   if (context.externalValueSet()) {
     value = context.externalValue();
   } else {
     value = context.parser().textOrNull();
   }
   if (value != null) {
     final BytesRef bytes = new BytesRef(value.toString());
     final long hash =
         MurmurHash3.hash128(bytes.bytes, bytes.offset, bytes.length, 0, new MurmurHash3.Hash128())
             .h1;
     super.innerParseCreateField(context.createExternalValueContext(hash), fields);
   }
 }