9.7. Deleting Indexes

This section describes how to remove attributes and index types from the index.

9.7.1. Deleting an Attribute from the Default Index Entry

When using the default settings of Directory Server, several attributes listed in the default index entry, such as sn, are indexed. The following attributes are part of the default index:

Table 9.5. Default Index Attributes

aci
cn
entryusn
givenName
mail
mailAlternateAddress
mailHost
member
memberOf
nsUniqueId
ntUniqueId
ntUserDomainId
numsubordinates
objectclass
owner
parentid
seeAlso
sn
telephoneNumber
uid
uniquemember

Warning

Removing system indexes can significantly affect the Directory Server performance.
For example, to remove the sn attribute from the default index:
  1. Remove the attribute from the cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config entry:
    # ldapdelete -D "cn=Directory Manager" -W -p 389 -h server.example.com -x
    cn=sn,cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config
    If you do not remove the attribute from this entry, the index for the sn attribute is automatically recreated and corrupted after the server is restarted.
  2. Remove the cn=attribute_name,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config entry. For details, see:
  3. Run the db2index.pl Perl script to recreate the index:
    # db2index.pl -Z instance_name -D "cn=Directory Manager" -w secret -n database_name
    For further information about using the db2index.pl Perl script, see the db2index.pl(8) man page.

9.7.2. Removing an Attribute from the Index Using the Server Console

The Directory Server Console can delete any custom indexes, indexes used by other server applications such as a messaging or web server, and default indexes.
To remove an attribute from the index:
  1. If the attribute to remove is listed in the cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config default index entry, remove it from this entry first. For details, see Section 9.7.1, “Deleting an Attribute from the Default Index Entry”.
  2. Select the Configuration tab.
  3. Expand the Data node and expand the suffix associated with the database containing the index.
  4. Select the database from which to delete the index.
  5. Locate the attribute containing the index to delete. Clear the check box under the index.
    To delete all indexes maintained for a particular attribute, select the attribute's cell under Attribute Name, and click Delete Attribute.
  6. Click Save.
    A Delete Index warning dialog box opens, requiring a confirmation to delete the index.
  7. Click Yes to delete the index.

9.7.3. Removing an Attribute from the Index Using the Command Line

In certain situations you want to remove an attribute from the index. For example, to remove the sn attribute:
  1. If the attribute to remove is listed in the cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config default index entry, you must remove it from this entry first. For details, see Section 9.7.1, “Deleting an Attribute from the Default Index Entry”.
  2. Remove the attribute from the index:
    # ldapdelete -D "cn=Directory Manager" -W -p 389 -h server.example.com -x
    cn=sn,cn=index,cn=database_name,cn=ldbm database,cn=plugins,cn=config
    After deleting the entry, the index for the sn attribute is no longer maintained.
  3. Run the db2index.pl Perl script to recreate the index.
    # db2index.pl -Z instance_name -D "cn=Directory Manager" -w secret -n database_name
    For further information about using the db2index.pl Perl script, see the db2index.pl(8) man page.

9.7.4. Deleting Index Types from the Command Line

For example, to remove the sub index type of the sn attribute from the index:
  1. Remove the index type:
    # ldapmodify -D "cn=directory manager" -W -x
    dn: cn=sn,cn=index,cn=database_name,cn=ldbm database,cn=plugins,cn=config
    
    changetype: modify
    delete: nsIndexType
    nsIndexType:sub
    After deleting the index entry, the substring index for the sn attribute is no longer maintained.
  2. Run the db2index.pl Perl script to recreate the index. For example:
    # db2index.pl -Z instance_name -D "cn=Directory Manager" -w secret -n database_name
    For further information about using the db2index.pl Perl script, see the db2index.pl(8) man page.

9.7.5. Deleting Browsing Indexes from the Server Console

  1. Select the Directory tab.
  2. Select the entry from which to delete the index in the navigation tree, and select Delete Browsing Index from the Object menu.
    Alternatively, select and right-click the entry of the index to delete in the navigation tree, and then choose Delete Browsing Index from the pop-up menu.
  3. A Delete Browsing Index dialog box appears asking you to confirm the deletion of the index. Click Yes.
  4. The Delete Browsing Index dialog box appears displaying the status of the index deletion.

9.7.6. Deleting Browsing Indexes from the Command Line

Deleting a browsing index or virtual list view (VLV) index from the command line involves two steps:
  1. Using the ldapdelete to delete browsing index entries or edit existing browsing index entries (Section 9.7.6.1, “Deleting a Browsing Index Entry”).
  2. Running the vlvindex script to generate the new set of browsing indexes to be maintained by the server (Section 9.7.6.2, “Running the vlvindex Script”). Alternatively, launch an appropriate task under cn=tasks,cn=config (Section 9.4.2.3, “Using a cn=tasks Entry to Create a Browsing Index”).
The actual entries for an alphabetical browsing index and virtual list view are the same. The following sections describe the steps involved in deleting browsing indexes.

9.7.6.1. Deleting a Browsing Index Entry

Use the ldapdelete command-line utility to either delete browsing indexing entries or edit existing browsing index entries. To delete browsing indexes for a particular database, remove the browsing index entries from the cn=index,cn=database_name,cn=ldbm database,cn=plugins,cn=config entry, where cn=database_name corresponds to the name of the database.
For example, there is a browsing index for accelerating ldapsearch operations on the entry ou=People,dc=example,dc=com. It held in the Example1 database where the search base is ou=People,dc=example,dc=com, the search filter is (|(objectclass=*)(objectclass=ldapsubentry)), the scope is 1, and the sorting order for the returned attributes is cn, givenname, o, ou, and sn.
To delete this browsing index, delete the two corresponding browsing index entries:
dn: cn=MCC ou=People dc=example dc=com,cn=userRoot,cn=ldbm database,cn=plugins,cn=config
objectClass: top
objectClass: vlvSearch
cn: MCC ou=People dc=example dc=com
vlvBase: ou=People,dc=example,dc=com
vlvScope: 1 vlvFilter: (|(objectclass=*)(objectclass=ldapsubentry))

dn: cn=by MCC ou=People dc=example dc=com,cn=MCC ou=People
dc=example dc=com,cn=userRoot,cn=ldbm database,cn=plugins,cn=config
objectClass: top
objectClass: vlvIndex
cn: by MCC ou=People dc=example dc=com
vlvSort: cn givenname o ou sn
Run ldapdelete, specifying both entries.
ldapdelete -D "cn=directory manager" -w secret -p 389 -h server.example.com -x "cn=MCC ou=People dc=example dc=com,cn=userRoot,cn=ldbm database,cn=plugins,cn=config" "cn=by MCC ou=People dc=example dc=com,cn=MCC ou=People dc=example dc=com,cn=userRoot,cn=ldbm database,cn=plugins,cn=config"
After deleting the two browsing index entries, the browsing index will no longer be maintained by the Example1 database.

9.7.6.2. Running the vlvindex Script

After deleting browsing indexing entries or unwanted attribute types from existing browsing indexing entries, run the vlvindex script to generate the new set of browsing indexes to be maintained by the Directory Server. After the script is run, the new set of browsing indexes is active for any new data added to the directory and any existing data in the directory.
  1. Stop the server.
    [root@server ~]# service dirsrv stop instance
  2. Run the vlvindex script.
    [root@server ~]# /etc/dirsrv/slapd-instance_name/vlvindex -n Example1 -T "by MCC ou=people dc=example dc=com"
    For more information about using the vlvindex script, see the Directory Server Configuration and Command-Line Tool Reference.
  3. Restart the server.
    [root@server ~]# service dirsrv start instance
Table 9.4, “vlvindex Options” describes the vlvindex options.
Alternatively, create a new task entry under cn=index,cn=tasks,cn=config to initiate an indexing operation. This task entry requires a unique name (cn) and one other attribute, nsIndexVLVAttribute, which gives the name of the browsing index definition entry to use to generate the VLV index. This task is the same as running vlvindex.
For example:
ldapmodify -a -D "cn=directory manager" -W -p 389 -h server.example.com -x

dn: cn=example VLV index,cn=index,cn=tasks,cn=config
changetype: add
objectclass: extensibleObject
cn: example VLV index
nsIndexVLVAttribute: "by MCC ou=people,dc=example,dc=com"
As soon as the task is completed, the entry is removed from the directory configuration.
The Directory Server Configuration and Command-Line Tool Reference has more information on running Directory Server tasks under the cn=tasks entries.