OrientDB Manual


The SQL Create Index command creates an index on a property defined in the schema.

Indexes can be:

  • unique, doesn't allow duplicated
  • not unique, allows duplicates
  • full-text, by indexing any single word of the text. It's used in query with the operator CONTAINSTEXT


CREATE INDEX <name> [ON <class-name> (prop-names)] <type> [<key-type>]


  • name logical name of index. Can be <class>.<property> to create an automatic index bound to a schema property. In this case class is the class of the schema and property, is the property created into the class. Notice that in another case index name can't contain '.' symbol
  • class-name name of class that automatic index created for. Class with such name must already exist in database
  • prop-names comma-separated list of properties that this automatic index is created for. Property with such name must already exist in schema
  • type, between 'unique', 'notunique' and 'fulltext'
  • key-type, is the type of key (Optional). On automatic indexes is auto-determined by reading the target schema property where the index is created. If not specified for manual indexes, at run-time during the first insertion the type will be auto determined by reading the type of the class.


CREATE INDEX users.Id unique

For more information look at Create index command.

For complete index guide look at Index guide.

To know more about other SQL commands look at SQL commands.

This is a command of the Orient console. To know all the commands go to Console-Commands.