Source: https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/index/create-fulltext/ Documentation version: v5.3.2 # CREATE FULLTEXT INDEX statement The CREATE FULLTEXT INDEX statement creates a full-text index on a specific graph. To specify the graph, use either of the following methods: - Add a [USE clause](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/dql/clauses/use-graph/) before this statement to set the working graph. - Use [SESSION SET](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/sessions/set/) to set the graph for the current session in advance. If both methods are used, the one specified in the USE clause takes precedence. If neither is used, an error occurs. You can create a full-text index based on a `STRING` property of a node type or edge type. Full-text indexes enable you to efficiently search for specific words or phrases within the indexed properties. After a full-text index is created, you can use the [ftscore()](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/fe/functions/fulltext/#ftscore) function to calculate the score of relevance between the `STRING` value stored by the indexed property and a given query string. To create other types of indexes, see [CREATE NORMAL INDEX](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/index/create/), [CREATE VECTOR INDEX](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/index/create-vector/), and [CREATE SPATIAL INDEX](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/index/create-geo/). Note An operation involving a non-default schema or an object in it requires access to the schema, either implicitly or through an explicit `USAGE` grant, as well as the privilege required for the operation. The schema access check and the privilege check for the requested operation are independent; satisfying one does not satisfy the other. Schema access control does not apply to temporary graphs or built-in procedures and functions. For more information, see [Schema access control](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authorization/schema-access-control/). ## Prerequisites - A graph is created. For more information, see [CREATE GRAPH](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/graph/create/). - To create a full-text index, you must either be the owner of the graph, be granted to perform the action `INDEX` on the graph, or be granted to perform the action `CREATE INDEX` on the used schema. For more information, see [Roles and privileges](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authorization/). ## Syntax diagramsource create_fulltext_index_statement ```` create_fulltext_index_statement ::= 'CREATE' 'FULLTEXT' 'INDEX' ('IF NOT EXISTS')? index_name 'ON' ( ( ('NODE' | 'VERTEX') 'TYPE'? node_type_name) | ( ('EDGE'|'RELATIONSHIP') 'TYPE'? edge_type_name) ) '(' property_name ')' ```` ## Parameters ### `IF NOT EXISTS` This clause checks if an index with the same name already exists. If it already exists, the index is not created and no exception is thrown. If you do not specify this clause, an exception is thrown if an index with the same name already exists. ### `index_name` The name of the full-text index to be created. The name is a regular identifier, and must be unique among all types of indexes within the same graph. For more information about identifiers, see [Rules for naming identifiers](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/overview/keywords-identifiers/#rules_for_naming_identifiers). ### `node_type_name` The name of the node type on which the full-text index is created. The node type must have at least one property whose value type is `STRING`. ### `edge_type_name` The name of the edge type on which the full-text index is created. The edge type must have at least one property whose value type is `STRING`. ### `property_name` The name of the property of the node type or edge type on which the full-text index is created. The value type of the property must be `STRING`. For more information, see [String type](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/c-string-type/). Note that only one property can be specified for each full-text index. ## Examples The following examples are based on the [example dataset](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/overview/example-dataset/). ### Create a full-text index on a node type ```` USE movie CREATE FULLTEXT INDEX IF NOT EXISTS ft_movie ON NODE Movie(name) ````