code: private void ensureIndex(DS session, L label, PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata, boolean unique) {
          PropertyMetadata propertyMetadata = propertyMethodMetadata.getDatastoreMetadata();
          String statement;
          if (unique) {
              LOGGER.debug("Creating constraint for label {} on property '{}'.", label, propertyMetadata.getName());
              statement = String.format("CREATE CONSTRAINT ON (n:%s) ASSERT n.%s IS UNIQUE", label.getName(), propertyMetadata.getName());
          } else {
              LOGGER.debug("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
              statement = String.format("CREATE INDEX ON :%s(%s)", label.getName(), propertyMetadata.getName());
          }
          try (ResultIterator iterator = session.createQuery(Cypher.class).execute(statement, Collections.emptyMap())) {
          }
      }
docs: Ensures that an index exists for the given label and property.
  
  @param session
  The datastore session
  @param label
  The label.
  @param propertyMethodMetadata
  The property metadata.
  @param unique
  if <code>true</code> create a unique constraint