Composite index filter patterns
You can use the following filter patterns to define a composite index.
Presence matching
Using a presence matching filter causes the server to index the specified attribute for presence matching, which identifies every entry that contains any value for the target attribute. The server uses this index to process searches with presence components.
- Syntax and usage
-
Presence components use the following syntax:
(attributeName=)
. You can use a standalone presence component in a simple filter or as part of an AND filter pattern, for example"(&(objectClass=?)(attributeName=))"
.
You can replace existing presence attribute indexes with composite indexes for improved scalability or to limit the scope of index keys by using a base DN pattern. |
Equality matching
Using an equality matching filter causes the server to index all unique values for the specified attribute for equality matching. The server uses this index to process searches with:
-
Equality filter components that target the specified attribute
-
Greater-than-or-equal or less-than-or-equal components that target the specified attribute
-
Substring components with a subInitial (starts with) element that targets the specified attribute
Substring filter components can also have subAny (contains) and subFinal (ends with) elements, but the server requires a subInitial element to use a composite index with these types of filters.
- Syntax and usage
-
Equality components use the following syntax:
(attributeName=?)
. You can use an equality component in a simple filter or as part of an AND filter, either with multiple equality components or combined with other supported filter pattern components.
For AND filters that contain multiple equality components:
-
You can add an ordering or substring matching component, but you must place it last in the filter.
-
All other components in the filter must be equality matching components.
Learn more about when to use a composite equality index instead of an attribute equality index in Composite indexes. |
Static equality matching
Using a static equality filter causes the server to index all entries that have the specified value for the given attribute. The server uses this index to process searches with that specific equality filter component.
- Syntax and usage
-
Static equality components use the following syntax:
(attributeName={staticValue})
. You can use a static equality component in a simple filter or as part of an AND filter, either with multiple static equality components or combined with other supported filter pattern components.
Use static equality matching to index specific attribute values that are present in a large number of entries. |
Substring matching
Using a substring matching filter causes the server to index values for the specified attribute for substring matching with filters that include subAny (contains) or subFinal (ends with) components. The server doesn’t use substring matching to index subInitial (starts with) components because they are better handled with equality filter patterns.
The server can use a composite index with this filter pattern to process any searches with substring filter components that target the specified attribute. For filters with subInitial (starts with) elements, the server might prefer to search using an available equality index for the attribute type, if one is available.
- Syntax and usage
-
Substring components use the following syntax:
(attributeName=?)
. You can only use one substring component in a given filter pattern, and it needs to be the last component of the pattern.
Approximate matching
Using an approximate matching filter causes the server to index all unique values for the specified attribute for approximate matching. The server uses this index to process searches with approximate matching filter components that target the specified attribute.
- Syntax and usage
-
Approximate matching components use the following syntax:
(attributeName~=?)
. You can use an approximate matching component in a simple filter or as part of an AND filter pattern, for example"(&(givenName=?)(sn=?))"
.
You can replace existing approximate matching attribute indexes with composite indexes for improved scalability or to limit the scope of index keys by using a base DN pattern. |
Guidelines for using AND filter patterns
You can specify an AND filter pattern with one or more presence, wildcard equality, static equality, or wildcard approximate matching filters, followed by a maximum of one wildcard substring filter. Each filter component inside the AND must specify a different attribute type.
Using this filter pattern causes the server to index entries with at least one value for each specified attribute. The server uses this index to process searches using AND filters that contain all but the last of those attribute types in equality filters and that contain the last attribute type in an appropriate filter for the wildcard filter.
For example, the server will use a composite index with filter pattern "(&(tenantID=?)(sn=?))"
to process AND filters containing a tenantID
equality filter and either an sn
equality filter, an sn
ordering filter, or an sn
substring filter with at least a subInitial (starts with) element.