Jupiter.Market.Elastic.Comparables.Services.ElasticIndexService
Handles indexing, cleanup, and synchronization of deal data with the !:Elastic.ComparablesIndex in Elasticsearch.
This service manages the lifecycle of the Comparables Index, reading from Table.Deal, Table.Listing, Table.Sale, and Table.Lease to populate and maintain the index.
See the detailed conceptual article: ElasticIndexService Logic.
Methods
#ctor
Initializes a new instance of the #ctor class.
Parameters:
- esOptions: Elasticsearch settings.
- indexerOptions: Indexer settings.
- dataService: The data service for deal retrieval.
- serviceBusMessageService: The service bus message service for deal messaging.
- logger: The logger instance.
- serviceBusSettingsOptions: Service Bus settings.
Jupiter.Market.Elastic.Comparables.Services.ElasticIndexService.InitAsync
No summary available.
Jupiter.Market.Elastic.Comparables.Services.ElasticIndexService.GetClientAsync
No summary available.
Returns: The instance.
GetMissingEntries
No summary available.
Parameters:
- sendToServiceBus: Whether to send missing entries to Service Bus.
CleanElasticIndexAsync
No summary available.
Parameters:
- comparableType: Optional comparable type filter.
Jupiter.Market.Elastic.Comparables.Services.ElasticIndexService.DeleteIndex
No summary available.
Jupiter.Market.Elastic.Comparables.Services.ElasticIndexService.CreateIndex
No summary available.
UpsertIndex
No summary available.
This method computes a deterministic SHA-256 hash (DocHash) for each UpsertIndex using a canonical JSON representation (camelCase, stable enum serialization, ignoring nulls and property order). It then fetches all existing documents' hashes from Elasticsearch in a single ids query, compares the hashes, and only bulk indexes documents whose hash is missing or different. This avoids unnecessary re-indexing and eliminates per-document GETs and deep JSON comparisons, optimizing for production-scale indexing.
Steps: Compute DocHash for each input UpsertIndex.Fetch existing DocHash values for all IDs in a single Elasticsearch query.Compare hashes and filter to only changed or new documents.Bulk index only the changed/new documents.
Parameters:
- comps: The list of deals to upsert. Each deal will have its DocHash property set before indexing.
Returns: The bulk response from Elasticsearch, or null if no documents required re-indexing.
DeleteFromIndex
No summary available.
Parameters:
- dealId: The deal ID to delete.
QueryAndSendToServiceBusAsync
No summary available.
This method:Parses the QueryJson from ElasticsearchSettings configurationExecutes a scroll query against the Elasticsearch indexStreams document IDs in batches to Service Bus via ServiceBusMessageServiceLogs progress periodically
The query can potentially match millions of documents and uses Elasticsearch scroll API for efficient streaming without loading all results into memory.
Parameters:
- cancellationToken: Cancellation token for the operation.