Previous Next JavaScript must be enabled to correctly display this content

## Deregistering Elasticsearch from an Oracle NoSQL Store

Oracle NoSQL Database implements 'one store, one Elasticsearch cluster' policy. That is, a given store cannot be simultaneously registered with more than one Elasticsearch cluster. This policy is expressed through the registration model. See Registering Elasticsearch with Oracle NoSQL Database. Thus, if your store is currently registered with one Elasticsearch cluster, but you wish to register with a second cluster, then you must first deactivate – or deregister – the current registration. This is accomplished by executing the following `deregister-es` plan.

    plan deregister-es [-wait]

Note:

Because of the one store, one cluster policy, the `deregister-es` command takes no arguments.

The store cannot deactivate a registration unless all indexes created under that registration have first been deleted from the Elasticsearch cluster. This can be accomplished by executing the `DROP INDEX` command on each of the Full Text Indexes created by the store and located in the Elasticsearch cluster with which the store is registered. That is, from the Admin CLI, a command with the following form should be executed for each index:

    execute 'DROP INDEX [IF EXISTS] <index> ON <table>';

Since the Elasticsearch cluster is created, maintained, and administered separate from the Oracle NoSQL Database store, that cluster may contain indexes that were created outside of the store's control, using the Elasticsearch API. These sort of indexes are not known to the store (are not in the store's state), and do not need to be deleted from the cluster in order to deactivate the store's registration with the cluster. Only the indexes that were created in the Elasticsearch cluster via the Oracle NoSQL `CREATE FULLTEXT INDEX` command must be deleted for the `deregister-es` command to succeed.

If the `deregister-es` command fails because the cluster still contains Full Text Indexes created by the store, the output for the command will display the names of the indexes that must be dropped. For example,

    kv-> plan deregister-es –wait
    Cannot deregister ES because these text indexes exist:

    mytestIndex
    JokeIndex

    kv-> execute 'DROP INDEX mytestIndex ON myTable';
    Plan 16 completed successfully

    kv-> execute 'DROP INDEX JokeIndex ON myTable';
    Plan 17 completed successfully

    kv-> plan deregister-es –wait
    Plan 18 completed successfully

The show parameters command can then be executed again, and its output examined, to determine if the store is indeed no longer registered with the Elasticsearch cluster.

Note:

There are two index types that can exist in Oracle NoSQL Database: a regular or Secondary Index, and a Text Index (for Full Text Search). With respect to index creation or deletion, although separate statements are needed for index creation (to distinguish the type of index to create), the same `DROP INDEX` statement is used to remove either type of index. When applied to a text index, a `DROP INDEX` command like those shown above not only stops the population of the index from the associated Oracle NoSQL Database table, but also removes the mapping and all related documents from Elasticsearch.