@Override
  public void define(IndexDefinitionContext context) {
    NewRegularIndex index = context.create(
      DESCRIPTOR,
      newBuilder(config)
        .setDefaultNbOfShards(5)
        .build())
      // storing source is required because some search queries on issue index use terms lookup query onto the view index
      // and this requires source to be stored (https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html#query-dsl-terms-lookup)
      .setEnableSource(true);

    // type "view"
    TypeMapping mapping = index.createTypeMapping(TYPE_VIEW);
    mapping.keywordFieldBuilder(FIELD_UUID).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_PROJECTS).disableNorms().build();
  }
@Test
  public void define() {
    ViewIndexDefinition def = new ViewIndexDefinition(new MapSettings().asConfig());
    def.define(underTest);

    assertThat(underTest.getIndices()).hasSize(1);
    NewIndex index = underTest.getIndices().get("views");
    assertThat(index.getMainType())
      .isEqualTo(IndexType.main(Index.simple("views"), "view"));
    assertThat(index.getRelationsStream()).isEmpty();

    assertThat(index.getSetting("index.number_of_shards")).isEqualTo("5");
    assertThat(index.getSetting("index.number_of_replicas")).isEqualTo("0");
  }