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. The corresponding database entry value is a 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.

When the JSON field constraint indicates to index a JSON field, JSON indexes are automatically created. View indexes 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. Depending on the nature of the search filter, the ID list might contain references to entries that do not actually match the filter, such as if the field is a string and if the filter is configured to use case-sensitive matching.
equalsAny

Identifies entries that have 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, but 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:

  • Add, delete, modify, and modify distinguish name (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 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 also works with JSON indexes to make it possible to check their validity.
    • When rebuilding a JSON index with the rebuild-index tool, the attribute name must be followed by .json. Optionally, you can also add .<fieldName>, where <fieldName> is replaced by the name of the JSON field.
      bin/rebuild-index --index <attributeName>.json.<fieldName> 
    Note:

    For the exact name to use in rebuilding the index, run the dbtest tool with the list-database-containers option and --backendID property.

    bin/dbtest list-database-containers --backendID {backendID}
  • 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.