public void CheckMappings(ElasticClient client) { if(!client.TypeExists(typeExists => typeExists.Index(ElasticMappingConstants.INDEX_NAME).Type(ElasticMappingConstants.TYPE_ADMIN)).Exists) { if (!CreateAdmin(client)) throw new Exception(); } if(!client.TypeExists(typeExists => typeExists.Index(ElasticMappingConstants.INDEX_NAME).Type(ElasticMappingConstants.TYPE_PRODUCT)).Exists) { if (!CreateProduct(client)) throw new Exception(); } if(!client.TypeExists(typeExists => typeExists.Index(ElasticMappingConstants.INDEX_NAME).Type(ElasticMappingConstants.TYPE_USER)).Exists) { if (!CreateUser(client)) throw new Exception(); } if(!client.TypeExists(typeExists => typeExists.Index(ElasticMappingConstants.INDEX_NAME).Type(ElasticMappingConstants.TYPE_EMPLOYEE)).Exists) { if (!CreateEmployee(client)) throw new Exception(); } if(!client.TypeExists(typeExists => typeExists.Index(ElasticMappingConstants.INDEX_NAME).Type(ElasticMappingConstants.TYPE_SALES)).Exists) { if (!CreateSales(client)) throw new Exception(); } if(!client.TypeExists(typeExists => typeExists.Index(ElasticMappingConstants.INDEX_NAME).Type(ElasticMappingConstants.TYPE_SALES_INFO)).Exists) { if (!CreateSalesInfo(client)) throw new Exception(); } }