Skip to content

Deploy full-text index

Nebula Graph full-text indexes are powered by Elasticsearch. This means that you can use Elasticsearch full-text query language to retrieve what you want. Full-text indexes are managed through built-in procedures. They can be created only for variable STRING and FIXED_STRING properties when the listener cluster and the Elasticsearch cluster are deployed.

Before you start

Before you start using the full-text index, please make sure that you know the restrictions.

Deploy Elasticsearch cluster

To deploy an Elasticsearch cluster, see the Elasticsearch documentation.

When the Elasticsearch cluster is started, add the template file for the Nebula Graph full-text index. Take the following sample template for example:

{
 "template": "nebula*",
  "settings": {
    "index": {
      "number_of_shards": 3,
      "number_of_replicas": 1
    }
  },
  "mappings": {
    "properties" : {
            "tag_id" : { "type" : "long" },
            "column_id" : { "type" : "text" },
            "value" :{ "type" : "keyword"}
        }
  }
}

Make sure that you specify the following fields in strict accordance with the preceding template format:

"template": "nebula*"
"tag_id" : { "type" : "long" },
"column_id" : { "type" : "text" },
"value" :{ "type" : "keyword"}

You can configure the Elasticsearch to meet your business needs. To customize the Elasticsearch, see Elasticsearch Document.

Sign in to the text search clients

SIGN IN TEXT SERVICE [(<elastic_ip:port> [,<username>, <password>]), (<elastic_ip:port>), ...]

When the Elasticsearch cluster is deployed, use the SIGN IN statement to sign in to the Elasticsearch clients. Multiple elastic_ip:port pairs are separated with commas. You must use the IPs and the port number in the configuration file for the Elasticsearch. For example:

nebula> SIGN IN TEXT SERVICE (127.0.0.1:9200);

Elasticsearch does not have username or password by default. If you configured a username and password, you need to specify in the SIGN IN statement.

Show text search clients

SHOW TEXT SEARCH CLIENTS

Use the SHOW TEXT SEARCH CLIENTS statement to list the text search clients. For example:

nebula> SHOW TEXT SEARCH CLIENTS;
+-------------+------+
| Host        | Port |
+-------------+------+
| "127.0.0.1" | 9200 |
+-------------+------+
| "127.0.0.1" | 9200 |
+-------------+------+
| "127.0.0.1" | 9200 |
+-------------+------+

Sign out to the text search clients

SIGN OUT TEXT SERVICE

Use the SIGN OUT TEXT SERVICE to sign out all the text search clients. For example:

nebula> SIGN OUT TEXT SERVICE;

Last update: December 17, 2020
Back to top