© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Apache TinkerPopAT
Apache TinkerPop•4y ago•
8 replies
Shush

Neptune - multiple labels

Hey,

For some reason we had a few objects that had multiple labels. This was done via a huge script and we couldn't find anything that caused it.

Now that the vertices have multiple labels, one of which is correct, is there a way to remove the other labels, or do we have to remove them and recreate the vertices?

From what I could find, the only way to have multiple labels in Neptune is
g.addV('label1'::'label2')
g.addV('label1'::'label2')
but I'm certain my script never did that. Is there another way in which it's possible?

Please advise.
Solution
Gremlin will not allow for you to remove labels. However, since Neptune supports both Gremlin and openCypher on the same data, you could use the openCypher support to remove the unwanted label(s):

For a vertex created with Gremlin using:
g.addV('test1::test2').property(id,'testV001')
g.addV('test1::test2').property(id,'testV001')

You could remove the
test2
test2
label using:
MATCH (n) 
WHERE id(n) IN ['testV001'] 
REMOVE n:test2 
RETURN n
MATCH (n) 
WHERE id(n) IN ['testV001'] 
REMOVE n:test2 
RETURN n


One possible way that you could end up with multiple labels is if you ran a bulk load job that had multiple rows with different labels per the same vertex ID:

~id, ~label
testV001, test1
testV001, test2
~id, ~label
testV001, test1
testV001, test2
Jump to solution
Apache TinkerPop banner
Apache TinkerPopJoin
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
1,376Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Multiple labels not working in mergeV() syntax for conditional inserts in AWS Neptune
Apache TinkerPopATApache TinkerPop / questions
3y ago
Neptune, Gremlin Java & Bindings
Apache TinkerPopATApache TinkerPop / questions
13mo ago
Profiling Neptune from javascript
Apache TinkerPopATApache TinkerPop / questions
16mo ago
Neptune Cluster Balancing Configuration
Apache TinkerPopATApache TinkerPop / questions
17mo ago