7.7. Deleting Indexes

This section describes how to delete presence, equality, approximate, substring, international, and browsing indexes for specific attributes.

NOTE

Because Directory Server 8.2 can operate in either a single or multi-database environment, you have to delete any unwanted indexes from every database instance. Any default indexes you delete will not be deleted from previous sets of indexes on existing database instances.

WARNING

Do not delete system indexes because deleting them can significantly affect Directory Server performance. System indexes are located in the cn=index,cn=instance,cn=ldbm database,cn=plugins,cn=config entry and the cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config entry.
Also, be cautious when deleting default indexes since this can also affect how Directory Server works.

7.7.1. Deleting Indexes from 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.

NOTE

You cannot delete system indexes.
  1. Select the Configuration tab.
  2. Expand the Data node and expand the suffix associated with the database containing the index.
  3. Select the database from which to delete the index.
  4. Locate the attribute containing the index to delete. Clear the checkbox under the index.
    To delete all indexes maintained for a particular attribute, select the attribute's cell under Attribute Name, and click Delete Attribute.
  5. Click Save.
    A Delete Index warning dialog box opens, requiring a confirmation to delete the index.
  6. Click Yes to delete the index.

7.7.2. Deleting Indexes from the Command Line

Creating browsing indexes, or virtual list view (VLV) indexes, using the ldapdelete command-line utility has two steps:
  1. Delete an entire index entry or delete unwanted index types from an existing index entry using the ldapdelete command-line utility (Section 7.7.2.1, “Deleting an Index Entry”).
  2. Generate the new set of indexes to be maintained by the server using the db2index.pl Perl script (Section 7.7.2.2, “Running the db2index.pl Script”).

7.7.2.1. Deleting an Index Entry

Use the ldapdelete command-line utility to delete either the entire indexing entry or the unwanted index types from an existing entry.
  • To delete the indexes for a particular database, remove the index entry 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.
  • To delete a default index, remove it from the cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config entry.
  1. Run ldapdelete.[6]
    ldapdelete -D "cn=Directory Manager" -w secret -h ExampleServer
         -p 389 "cn=sn,cn=index,cn=Example1,dn=ldbm database,cn=plugins,dn=config"
    For complete information on ldapdelete, see the Directory Server Configuration and Command-Line Tool Reference.
  2. For example, delete the presence, equality, and substring indexes for the sn attribute on the database named Example1:
    dn: cn=sn,cn=index,cn=Example1,cn=ldbm database,cn=plugins,cn=config 
    objectClass:top 
    objectClass:nsIndex 
    cn:sn 
    nsSystemIndex:false 
    nsIndexType:pres 
    nsIndexType:eq 
    nsIndexType:sub 
    nsMatchingRule:2.16.840.1.113730.3.3.2.3.1
Table 7.5, “ldapdelete Options” describes the ldapdelete options.

Table 7.5. ldapdelete Options

Option Description
-D Specifies the distinguished name with which to authenticate to the server. The value must be a DN recognized by the Directory Server, and it must also have the authority to modify the entries.
-w Specifies the password associated with the distinguished name specified in the -D option.
-h Specifies the name of the host on which the server is running.
-p Specifies the port number that the server uses.

After deleting the index entry, the presence, equality, and substring indexes for the sn attribute are no longer maintained by the Example1 database.

7.7.2.2. Running the db2index.pl Script

After deleting an indexing entry or some of the index types from an indexing entry, run the db2index.pl script to generate the new set of indexes to be maintained by the Directory Server. Once you run the script, the new set of indexes is active for any new data you add to your directory and any existing data in your directory.
To run the db2index.pl Perl script:
  1. Open the Directory Server instance directory.
    cd /etc/dirsrv/slapd-instance_name
  2. Run the db2index.pl Perl script. For example:
    db2index.pl-D "cn=Directory Manager" -w secret -n Example1
For more information about using the db2index.pl Perl script, refer to Directory Server Configuration and Command-Line Tool Reference. Table 7.6, “db2index Options” describes the db2index.pl options used in the examples:

Table 7.6. db2index Options

Option Description
-D Specifies the DN of the administrative user.
-w Specifies the password of the administrative user.
-n Specifies the name of the database into which you are importing the data.

7.7.3. 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.

7.7.4. 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 7.7.4.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 7.7.4.2, “Running the vlvindex Script”). Alternatively, launch an appropriate task under cn=tasks,cn=config (Section 7.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.

7.7.4.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.
  1. Run ldapdelete.[6]
    ldapdelete-D "cn=Directory Manager" -w secret -h ExampleServer
    -p 389 "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"
    
    For full information on ldapdelete options, see the Directory Server Configuration and Command-Line Tool Reference.
  2. 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
The following table describes the ldapdelete options used in the example:
Option Description
-D Specifies the distinguished name with which to authenticate to the server. The value must be a DN recognized by the Directory Server, and it must also have the authority to modify the entries.
-w Specifies the password associated with the distinguished name specified in the -D option.
-h Specifies the name of the host on which the server is running.
-p Specifies the port number that the server uses.
After deleting the two browsing index entries, the browsing index will no longer be maintained by the Example1 database.

7.7.4.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. Open the Directory Server instance directory.
    cd /etc/dirsrv/slapd-instance_name
  2. Stop the server.
    service dirsrv stop instance
  3. Run the vlvindex script.
    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.
  4. Restart the server.
    service dirsrv start instance
Table 7.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:
/usr/lib64/mozldap/ldapmodify -a -D "cn=directory manager" -w secret -p 389 -h server.example.com

dn: cn=example VLV index,cn=index,cn=tasks,cn=config
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.