Path: redb-route/redb.Route.Elasticsearch/ElasticsearchHeaders.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Elasticsearch/ElasticsearchHeaders.cs
----
namespace redb.Route.Elasticsearch;
///
/// Well-known header constants used by the Elasticsearch component.
/// Follows the redbEs. prefix convention.
///
public static class ElasticsearchHeaders
{
/// Common prefix for all Elasticsearch component headers.
public const string Prefix = "redbEs.";
// ═══════════════════════════════════════════════════════════════════
// COMMON (set by consumer, read by producer)
// ═══════════════════════════════════════════════════════════════════
/// Index name.
public const string IndexName = "redbEs.IndexName";
/// Document ID (_id).
public const string DocumentId = "redbEs.DocumentId";
/// Document version (_version).
public const string Version = "redbEs.Version";
/// Sequence number (_seq_no) for optimistic concurrency.
public const string SequenceNumber = "redbEs.SequenceNumber";
/// Primary term (_primary_term) for optimistic concurrency.
public const string PrimaryTerm = "redbEs.PrimaryTerm";
/// Operation to perform (used to override endpoint operation).
public const string Operation = "redbEs.Operation";
// ═══════════════════════════════════════════════════════════════════
// INDEX / UPDATE / DELETE RESULT
// ═══════════════════════════════════════════════════════════════════
/// Result of the operation: created, updated, deleted, noop.
public const string Result = "redbEs.Result";
// ═══════════════════════════════════════════════════════════════════
// SEARCH (consumer & producer)
// ═══════════════════════════════════════════════════════════════════
/// Relevance score (_score).
public const string Score = "redbEs.Score";
/// Total number of matching documents.
public const string TotalHits = "redbEs.TotalHits";
/// Total hits relation: "eq" or "gte".
public const string TotalHitsRelation = "redbEs.TotalHitsRelation";
/// Scroll context ID for scroll API.
public const string ScrollId = "redbEs.ScrollId";
/// Sort values from the last hit (for search_after pagination).
public const string SortValues = "redbEs.SortValues";
// ═══════════════════════════════════════════════════════════════════
// BULK
// ═══════════════════════════════════════════════════════════════════
/// Number of items in the bulk response.
public const string BulkItemCount = "redbEs.BulkItemCount";
/// Whether the bulk response had errors (bool).
public const string BulkErrors = "redbEs.BulkErrors";
/// Serialized error details from failed bulk items (JSON).
public const string BulkErrorItems = "redbEs.BulkErrorItems";
// ═══════════════════════════════════════════════════════════════════
// MULTISEARCH
// ═══════════════════════════════════════════════════════════════════
/// Number of individual search responses returned.
public const string MultiSearchResponseCount = "redbEs.MultiSearchResponseCount";
/// Whether any sub-query returned an error (bool).
public const string MultiSearchHasErrors = "redbEs.MultiSearchHasErrors";
/// Array of total hits per sub-query (long[]).
public const string MultiSearchTotalHits = "redbEs.MultiSearchTotalHits";
// ═══════════════════════════════════════════════════════════════════
// REQUEST ROUTING
// ═══════════════════════════════════════════════════════════════════
/// Ingest pipeline name override.
public const string Pipeline = "redbEs.Pipeline";
/// Custom routing value override.
public const string Routing = "redbEs.Routing";
/// Refresh policy override: "true", "false", or "wait_for".
public const string Refresh = "redbEs.Refresh";
/// Returns true if the header key starts with the ES prefix.
public static bool IsRedbHeader(string headerKey) =>
headerKey.StartsWith(Prefix, StringComparison.Ordinal);
}