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.
Precaution¶
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 Kubernetes Elasticsearch deployment or Elasticsearch installation.
Note
To support external network access to Elasticsearch, set network.host
to 0.0.0.0
in config/elasticsearch.yml
.
You can configure the Elasticsearch to meet your business needs. To customize the Elasticsearch, see Elasticsearch Document.
Sign in to the text search clients¶
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.
Syntax¶
SIGN IN TEXT SERVICE (<elastic_ip:port>, {HTTP | HTTPS} [,"<username>", "<password>"]) [, (<elastic_ip:port>, ...)];
Example¶
nebula> SIGN IN TEXT SERVICE (192.168.8.100:9200, HTTP);
Note
Elasticsearch does not have a username or password by default. If you configured a username and password, you need to specify them in the SIGN IN
statement.
Caution
The Elasticsearch client can only be logged in once, and if there are changes, you need to SIGN OUT
and then SIGN IN
again, and the client takes effect globally, and multiple graph spaces share the same Elasticsearch client.
Show text search clients¶
The SHOW TEXT SEARCH CLIENTS
statement can list the text search clients.
Syntax¶
SHOW TEXT SEARCH CLIENTS;
Example¶
nebula> SHOW TEXT SEARCH CLIENTS;
+-----------------+-----------------+------+
| Type | Host | Port |
+-----------------+-----------------+------+
| "ELASTICSEARCH" | "192.168.8.100" | 9200 |
+-----------------+-----------------+------+
Sign out to the text search clients¶
The SIGN OUT TEXT SERVICE
statement can sign out all the text search clients.
Syntax¶
SIGN OUT TEXT SERVICE;
Example¶
nebula> SIGN OUT TEXT SERVICE;