How to return a vertex ID by properties on the vertex?

Now I know some properties on a vertex, how can I get the vertex ID based on these properties? Please help.

Use the index feature:
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, a tag named entity has two properties name and age. Follow the steps below to look for the vertex ID with Amber as the value of name :
First, create an index 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 == "Amber";

| VertexID |
| 101      |

If you don’t specify the return result by YIELD, the vertex ID is returned by default.

  1. First create a tag and then create an index for the tag
  2. Rebuild the index if there is already data for the tag.