I am using Nebula Graph to store a graph of multiple nodes. For example: I have TAG named Entity has one attribute name, an EDGE named call with no attributes. I inserted many vertices of type Entity and they have edge of type call between them. I want to query my graph for a specific vertex. I have only its name I do not know the id under which it was inserted. I read the manual of ngql and I went over the usage of "Go from" statement I was not able to find a way to do the query starting from the attribute value of the vertex. Can anyone help me in that? : I want to do this : find the vertex id that has name = "x".
CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] <index_name> ON {<tag_name> | <edge_name>} (prop_name_list)
LOOKUP ON {<vertex_tag> | <edge_type>} WHERE <expression> [ AND | OR expression ...]) ] [YIELD <return_list>]
For example, in your case, assume you have a tag entity, there are two properties in it, name and age. If you want to know the vertex ID with name Amber, the query is like the following: First, you build an index on entity:
CREATE TAG entity(name string, age int);
CREATE TAG INDEX entity_index ON entity(name, age);
INSERT VERTEX entity(name, age) VALUES 101:("Amber", 21);
LOOKUP ON entity WHERE entity.name == "Amber";
============
| VertexID |
============
| 101 |
------------
If you don't specify keyword YIELD, vertex ID is returned by default. Do let me know if this helps.
Note: