public static GenericSearchDocument ToGenericElasticSearchDoc <TFunctionMessage>( this TransactionForFunctionVO <TFunctionMessage> functionCall, FunctionIndexDefinition <TFunctionMessage> indexDefinition) where TFunctionMessage : FunctionMessage, new() { var dictionary = new GenericSearchDocument(); foreach (var field in indexDefinition.Fields) { var val = field.GetTransactionForFunctionValue(functionCall)?.ToElasticSearchFieldValue(); if (val != null) { dictionary.Add(field.Name.ToElasticName(), val); } } var id = indexDefinition.KeyField().GetTransactionForFunctionValue(functionCall); dictionary.SetId(id.ToString()); return(dictionary); }
public static GenericSearchDocument ToGenericElasticSearchDoc( this FilterLog log, SearchField[] searchFields) { var dictionary = new GenericSearchDocument(); foreach (var field in searchFields) { var val = field.GetFilterLogValue(log)?.ToElasticSearchFieldValue(); if (val != null) { dictionary.Add(field.Name.ToElasticName(), val); } } var id = log.Key(); dictionary.SetId(id.ToString()); return(dictionary); }
public static GenericSearchDocument ToGenericElasticSearchDoc <TEvent>( this EventLog <TEvent> log, EventIndexDefinition <TEvent> indexDefinition) where TEvent : class { var dictionary = new GenericSearchDocument(); foreach (var field in indexDefinition.Fields) { var val = field.GetEventLogValue(log)?.ToElasticSearchFieldValue(); if (val != null) { dictionary.Add(field.Name.ToElasticName(), val); } } var id = indexDefinition.KeyField().GetEventLogValue(log); dictionary.SetId(id.ToString()); return(dictionary); }
public static GenericSearchDocument ToGenericElasticSearchDoc( this TransactionReceiptVO transactionReceiptVO, TransactionReceiptVOIndexDefinition indexDefinition) { var dictionary = new GenericSearchDocument(); foreach (var field in indexDefinition.Fields) { var val = field.GetTransactionReceiptValue(transactionReceiptVO)?.ToElasticSearchFieldValue(); if (val != null) { dictionary.Add(field.Name.ToElasticName(), val); } } var id = transactionReceiptVO.TransactionHash; dictionary.SetId(id.ToString()); return(dictionary); }