protected TypeMapping createTypeMapping(IndexMainType mainType) {
    checkArgument(mainType.getIndex().equals(index), "Main type must belong to index %s", index);
    return new TypeMapping(this);
  }
@Test
  public void createTypeMapping_with_IndexRelationType_fails_with_ISE_if_index_does_not_allow_relations() {
    IndexType.IndexRelationType indexRelationType = IndexType.relation(IndexType.main(Index.withRelations(someIndexName), "bar"), "bar");

    Index index = Index.simple(someIndexName);
    IndexMainType mainType = IndexType.main(index, "foo");
    NewIndex underTest = new NewIndex(index, defaultSettingsConfiguration) {
      @Override
      public IndexMainType getMainType() {
        return mainType;
      }

      @Override
      public BuiltIndex build() {
        throw new UnsupportedOperationException("build not implemented");
      }
    };

    assertThatThrownBy(() -> underTest.createTypeMapping(indexRelationType))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Index is not configured to accept relations. Update IndexDefinition.Descriptor instance for this index");
  }