Keys
- Last UpdatedApr 01, 2026
- 2 minute read
Each data point within a stream must have a unique identifier. Therefore, the first property included in your type should be intended for use as the key—the property (or combination of properties) used to create an order of unique data points in a stream. Each type within the Streams Store must have a key.
The key is usually a timestamp of type DateTime, but it can be any data type that can be ordered, such as an integer. The Streams Store does not store more than a single data point for a key.
In most use cases, defining a single key using a timestamp of property type DateTime is adequate to create a unique identifier for each data point. However, in more complex use cases, the property type that you use may not be enough to create a unique identifier—for example, if you use a simple numeric property as key, it may include multiple instances of identical values.
In these instances, you may need to create a compound key to form a unique identifier for your data points. Compound keys combine multiple properties to create the unique identifier. For example, in instances where a stream uses an integer as key, adding a second property to the key will form the required uniqueness.
Only system types can be designated as keys—user-created types cannot be used. You can use up to three properties in combination to create a key. While creating the key, you can reorder the properties to choose which properties have highest priority when the key is created.
The key for a type also functions as an index. The key is also called the primary index, as timestamps are usually the primary property used to query your stream data later.
When you create a type, you do not have to assign it a key, but if you save the type with no defined key, you cannot create a stream from it.