public async Task StoringCustomSearchDocuments_UsingMapper() { using (var processor = new AzureEventIndexingProcessor(AzureSearchServiceName, _azureSearchApiKey, BlockchainUrl)) { await ClearDown(processor); //create an azure index definition based on a custom Dto //the processor will create the index if it does not already exist var index = CreateAzureIndexDefinition(); var mapper = new CustomEventToSearchDocumentMapper(); try { //inject a mapping func to translate our event to a doc to store in the index await processor.AddAsync <TransferEvent_ERC20, CustomTransferSearchDocumentDto>(index, mapper); var blocksProcessed = await processor.ProcessAsync(3146684, 3146694); Assert.Equal((ulong)11, blocksProcessed); Assert.Equal(1, processor.Indexers.Count); Assert.Equal(19, processor.Indexers[0].Indexed); } finally { await ClearDown(processor); } } }
public async Task StoringCustomSearchDocuments_UsingMapper() { ElasticClient elasticClient = CreateElasticClient(); using (var processor = new ElasticEventIndexingProcessor(elasticClient, BlockchainUrl)) { await ClearDown(processor); try { var mapper = new CustomEventToSearchDocumentMapper(); // subscribe to transfer events // inject a mapper to translate the event DTO to a search document DTO var transferEventProcessor = await processor .AddAsync <TransferEvent_ERC20, CustomTransferSearchDocumentDto>( TransferIndexName, mapper); var blocksProcessed = await processor.ProcessAsync(3146684, 3146694); Assert.Equal((ulong)11, blocksProcessed); Assert.Equal(19, transferEventProcessor.Indexer.Indexed); } finally { await ClearDown(processor); } } }