table.indexRename(oldIndexName, newIndexName) → object
Rename an existing secondary index on a table. If the optArg overwrite
is specified as true
, a previously existing index with the new name will be deleted and the index will be renamed. If overwrite
is false
(the default) an error will be raised if the new index name already exists.
The return value on success will be an object of the format {"renamed":1}
, or {"renamed":0}
if the old and new names are the same.
An error will be raised if the old index name does not exist, if the new index name is already in use and overwrite
is false
, or if either the old or new index name are the same as the primary key field name.
Example: Rename an index on the comments table.
r.table("comments").indexRename("postId", "messageId").run(conn);
Example: Rename an index on the users table, overwriting any existing index with the new name.
r.table("users").indexRename("mail", "email").optArg("overwrite", true) .run(conn);
Couldn't find what you were looking for?
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/java/index_rename/