public async Task <ISearchResponse <Customer> > SearchCustomersByEmail(SearchCustomerCommand command) { _logger.LogInformation("BookRepository: SearchCustomersByEmail - Method started with values {@MethodValues}", command); var result = await _client.SearchAsync <Customer>(s => s .Index(_configuration["elasticsearch:customerIndexName"]) .Query(q => q .Terms(t => t .Field(f => f.Email.EmailAddress.Suffix("keyword")) .Terms(command.SearchTerm))) ); if (!result.IsValid) { _logger.LogError("BookRepository: SearchCustomersByEmail error occured during analyzing query by Elasticsearch, {@MethodValues}", command); return(result); } _logger.LogInformation("BookRepository: SearchCustomersByEmail successfully requested data from Elasticsearch"); return(result); }
private void SubscribeMessages() { Notify.SubscribeCustomerAction((sender) => { SearchCustomerCommand.Execute(null); }); }