public void Handle(Demo.Domain.Configuration.AccountType.Events.NameChanged e) { using (var session = _store.OpenSession()) { var gets = session.Query <Responses.Get>().Where(x => x.TypeId == e.AccountTypeId).ToList(); foreach (var get in gets) { get.Type = e.Name; } session.SaveChanges(); _manager.PublishAll(gets); } }
public void Handle(Demo.Domain.Configuration.AccountType.Events.NameChanged e) { var results = _elastic.Search <Responses.Index>(x => x .Query(q => q.Term(t => t.TypeId, e.AccountTypeId))); foreach (var result in results.Documents.Select(x => x.Id)) { _elastic.Update <Responses.Index, Object>(x => x .Id(result) .Doc(new { Type = e.Name }) .RetryOnConflict(3) .Refresh() ); } _manager.PublishAll(results.Documents); }