@Test
  public void testDetectOutsideChanges() throws Exception {
    ElasticSearchDataContext elasticSearchDataContext = (ElasticSearchDataContext) dataContext;

    // Create the type in ES
    final IndicesAdminClient indicesAdmin =
        elasticSearchDataContext.getElasticSearchClient().admin().indices();
    final String tableType = "outsideTable";

    Object[] sourceProperties = {
      "testA", "type=string, store=true", "testB", "type=string, store=true"
    };

    new PutMappingRequestBuilder(indicesAdmin)
        .setIndices(indexName)
        .setType(tableType)
        .setSource(sourceProperties)
        .execute()
        .actionGet();

    dataContext.refreshSchemas();

    assertNotNull(dataContext.getDefaultSchema().getTableByName(tableType));

    new DeleteMappingRequestBuilder(indicesAdmin)
        .setIndices(indexName)
        .setType(tableType)
        .execute()
        .actionGet();
    dataContext.refreshSchemas();
    assertNull(dataContext.getTableByQualifiedLabel(tableType));
  }