mongo/src/org/immutables/mongo/repository/internal/Support.java
public static Bson convertToIndex(final Constraints.ConstraintHost fields) {
    final Document document = new Document();
    fields.accept(new ConvertToIndex(document));
    return document;
  }
public static Bson convertToIndex(final Constraints.ConstraintHost fields) {
    final Document document = new Document();
    fields.accept(new ConvertToIndex(document));
    return document;
  }
Builds bson with index definition. The difference with
{@link #convertToBson(Constraints.ConstraintHost)} is that this method fails on duplicate
fields. Currently only one index is allowed per field.
@see <a href="https://docs.mongodb.com/manual/indexes/">Mongo Indexes</a>