public void CheckSource(string sourceName, bool recreate = false) { try { ElasticIndexValidator.ValidateIndex(sourceName); } catch (InvalidElasticIndexException e) { if (recreate) { elasticClient.Indices.Create(sourceName, i => i.Map <TModel>(x => x.AutoMap())); // Todo Custom mapping } else { throw e; } } }
private void CheckIndex(string indexName, bool recreate) { try { ElasticIndexValidator.ValidateIndex(indexName); } catch (InvalidElasticIndexException e) { if (recreate) { elasticClient.Indices.Delete(indexName); elasticClient.Indices.Create(indexName, i => i.Map <TModel>(x => x.AutoMap())); // Todo Custom mapping } else { throw e; } } }