JSON indexing is similar to general attribute indexing. Where an attribute can be indexed several ways and requires a separate database for each index type, there is only a single database for each JSON field that can be used for different JSON filter types. This database primarily behaves like the database for an equality attribute index. Each database entry key is the normalized form for a value for the target JSON field, and the corresponding database entry value is an list of the entry IDs for all entries in which the associated attribute type has a JSON object with that value for the target field. The database is configured with a comparator (based on the data type for the target field) that enables iterating through values in a logical order to facilitate inequality and subInitial searches.

JSON indexes are automatically created when the JSON Field constraint indicates that a JSON field should be indexed. Indexes can be viewed with the following command:
$ bin/dbtest list-index-status \
  --backendID userRoot \
  --baseDN dc=example,dc=com
The JSON object filter types that can be enhanced through the use of JSON indexes include:
  • equals. Identifies entries that have a specific value for the target field. This filter type only requires retrieving a single index key. However, depending on the nature of the search filter, the ID list may contain references to entries that don't actually match the filter (such as if the field is a string, and the filter is configured to use case-sensitive matching).
  • equalsAny. Identifies entries that have any of a specified set of values for the target field. This filter type only requires retrieving the index keys that correspond to the target values in the filter and merging their ID lists.
  • greaterThan/lessThan. Identifies entries that have at least one value for the target field that is greater or less than (or possibly equal to) a specified value. This index is similar in use to the containsField index, except that it only needs to iterate through a subset of the keys. A filter can contain both greaterThan and lessThan filters to represent a bounded range.
  • substring. Identifies entries that have a string value for the target field that matches a given substring. The index can only be used for substring filters that include a subInitial component. In this case, the server iterates through all of the index keys that match the startsWith component, and manually compares values against the remainder of the substring assertion.
JSON indexing is available in local database backends backed by Berkeley DB Java Edition. This includes the following:
  • Add, delete, modify, and modify DN operations that make changes to JSON objects stored in the server.
  • LDIF imports that include JSON objects, including updates to the cache size estimates for the JSON indexes.
  • The rebuild-index tool and corresponding backend code to make it possible to generate and rebuild indexes for JSON data. It must be possible to build all JSON indexes for all or a specified subset of fields associated with a given attribute type. The verify-index tool should also work with JSON indexes to make it possible to check their validity.
  • Matching entry count control and debugsearchindex return attribute provide information about relevant JSON index usage.
  • Support for monitoring index content and usage.
Note: Exploded indexes and the entry balancing global index do not support JSON objects.