Read time: 2 minutes
Last edited: Feb 27, 2023
This topic explains how to build and manage segments. Segments let you target groups of contexts by attribute.
Segments are lists of contexts that you can use to manage flag targeting behavior in bulk. Segments are useful for keeping groups of contexts, like
enterprise-customers, up to date. They allow you to more quickly turn features on or off for certain groups with confidence.
LaunchDarkly supports two types of segments:
- Standard segments
- Big Segments, including Big Segments synced with Amplitude
Understanding segment types
There are a few differences between standard segments and Big Segments. You cannot convert a segment from one kind to another after you create it, so choose the kind that best suits your use case when you create it.
This table explains the differences between standard segments and Big Segments:
|Segment type||Number of contexts||Backed by external data store||Supports uploading contexts from CSV||Supports targeting rules||Supports multiple context kinds|
|Standard segments||Up to 15,000|
|Big Segments||More than 15,000|
Targeting with segments
There are some differences between flag targeting and segment targeting:
- Segments are environment-specific. They do not populate in environments other than the one you created them in.
- Segment targeting can reference another segment only if both segments exist in the same environment, and if you're using a version of an SDK that supports contexts. To learn more, read SDKs.
To target a segment within another segment, you must be using the latest version of an SDK that supports the feature. To find out which versions of which SDKs support this feature, read the list of SDKs that support contexts.
If you target a segment within another segment but aren't using an updated SDK, the flag will skip the segment targeting rule and evaluate contexts against the next subsequent rule.
Like flags, you cannot create a circular reference between two segments, for example, where segment A targets segment B and segment B targets segment A.
Using the Segments list
You can view standard and Big Segments on the Segments list.
From the list, you can filter segments to display only those synced from Amplitude.
To create a new segment:
- Navigate to the Segments list.
- Click Create segment. The "Create a segment" panel appears.
- Give your segment a human-readable Name.
- Enter a Key for the segment. This field auto-populates based on the segment name, but you can change it if you need to.
- (Optional) Add a Description.
- (Optional) Choose Tags from the menu.
- Select the Standard option to create a standard segment, or the Big option to create a Big Segment. You cannot convert a segment from one kind to another after you create it.
- Click Save segment. The segment's Targeting tab appears.
You can further edit the segment's settings from its Settings tab.
Converting a rule into a standard segment
You may require complex targeting rules to successfully perform feature launches. You can convert both individual targets and targeting rules into standard segments from the flag's Targeting page.
To convert a rule to a standard segment:
- Navigate to the flag's Targeting tab.
- In the targeting section or the rule matching section, click the overflow menu of the rule you wish to convert. The overflow menu appears.
- Click "Convert to segment". The "Convert to segment" dialog appears.
- Give your segment a human-readable Name and a Key.
- (Optional) Add a Description.
- (Optional) Choose any Tags from the menu menu.
- Click Save segment. A confirmation appears indicating that you've created a new segment.
A new rule targeting the newly created segment appears in the list of targeting rules.
To delete a segment, find the segment you want to delete on the Segments list and click Delete.
Here are the topics in this category: