Class IndexTemplateConfiguration
- Namespace
- Excalibur.Data.ElasticSearch.IndexManagement
- Assembly
- Excalibur.Data.ElasticSearch.dll
Represents the configuration for an Elasticsearch index template.
public sealed class IndexTemplateConfiguration
- Inheritance
-
IndexTemplateConfiguration
- Inherited Members
Remarks
The SettingsJson and MappingsJson properties accept opaque JSON payloads so that consumers are not coupled to a specific Elasticsearch SDK version. Consumers who need typed configuration can serialize SDK types to JsonElement before assigning them:
var settings = new IndexSettings { NumberOfShards = 1 };
var config = new IndexTemplateConfiguration
{
IndexPatterns = ["logs-*"],
SettingsJson = JsonSerializer.SerializeToElement(settings),
};
Properties
AllowAutoCreate
Gets a value indicating whether this template should allow auto-creation of indices.
public bool AllowAutoCreate { get; init; }
Property Value
- bool
True to allow auto-creation, false otherwise. Defaults to true.
ComposedOf
Gets the component templates to be composed into this template.
public IEnumerable<string>? ComposedOf { get; init; }
Property Value
- IEnumerable<string>
A collection of component template names.
DataStream
Gets the data stream configuration if this template creates data streams.
public DataStreamConfiguration? DataStream { get; init; }
Property Value
- DataStreamConfiguration
The data stream configuration.
IndexPatterns
Gets the index patterns that this template applies to.
public required IEnumerable<string> IndexPatterns { get; init; }
Property Value
- IEnumerable<string>
A collection of index patterns (e.g., "logs-", "metrics-").
MappingsJson
Gets the field mappings as opaque JSON.
public JsonElement? MappingsJson { get; init; }
Property Value
- JsonElement?
The type mapping configuration as a JSON element, or null if not specified.
Metadata
Gets custom metadata associated with this template.
public Dictionary<string, object?>? Metadata { get; init; }
Property Value
- Dictionary<string, object>
A dictionary of metadata key-value pairs.
Priority
Gets the priority of this template when multiple templates match an index.
public int Priority { get; init; }
Property Value
- int
Higher values take precedence. Defaults to 100.
SettingsJson
Gets the template settings as opaque JSON.
public JsonElement? SettingsJson { get; init; }
Property Value
- JsonElement?
The index settings configuration as a JSON element, or null if not specified.
Version
Gets the version of this template for tracking changes.
public long? Version { get; init; }
Property Value
- long?
The template version number.