public void Save(T entity) { ElasticSearchClientHelper.CheckIndex <T>(_elasticClient, _indexName); entity.Id = Guid.NewGuid(); var result = _elasticClient.Index(entity, idx => idx.Index(_indexName)); if (!result.IsValid) { throw new Exception(result.OriginalException.Message); } }
protected BaseRepository(string indexName) { _elasticClient = ElasticSearchClientHelper.CreateElasticClient(); _indexName = indexName; }