Loading

Ingest strategies

Ingest strategies control how documents are written to Elasticsearch via the bulk API. They determine the bulk operation header for each document and the target URL.

public interface IDocumentIngestStrategy<in TDocument>
{
    BulkOperationHeader CreateBulkOperationHeader(TDocument document, string channelHash);
    string GetBulkUrl(string defaultPath);
    string RefreshTargets { get; }
}
		

Writes create operations to a data stream:

{"create": {"_index": "logs-myapp-default"}}
		

Writes index operations to a named index:

{"index": {"_index": "my-index"}}
		

Like IndexIngestStrategy but resolves the index name, document ID, and routing from ElasticsearchTypeContext accessors. Supports date-based index naming and hash-based index rotation.

Writes index operations with explicit document IDs for upsert patterns:

{"index": {"_index": "products", "_id": "product-123"}}
		

Writes to wired streams (Elasticsearch serverless managed streams). Uses create operations without explicit index targeting.