Could primary_id(v_id) of a vertex be used in a query body?

I was trying to use primary_id of a vertex (v_id) in a query body, but it complained with the followings. Just want to confirm with you guys. If that’s the case, then I have to add a new attribute in the schema, and what’s the benefit of doing this? Also, as I know that primary_id of a vetex could be used when loading data.
Any comment would be really appreciated.
- The expression refers to a primary_id, which is not directly
usable in the query body. To use primary_id, declare it as an
attribute. E.g "CREATE VERTEX Person (PRIMARY_ID ssn string, ssn string, age
- The expression has misspelled an attribute, or a vertex name


If you are writing the commands via Scripting use the " WITH primary_id_as_attribute=“true”

CREATE VERTEX State(PRIMARY_ID state_id STRING) WITH primary_id_as_attribute="true"

If you are using the GUI click “As attribute”


@Jon_Herke, thank you so much. It worked.

1 Like