I have a sample data that i modeled in my cosmos DB gremlin API. The sample csv is as follows
Name, Job Titles, Department
"ADRIANO, RACQUEL ANNE", PARAMEDIC, PARAMEDIC
"AFFANEH, MAHIR A", POLICE OFFICER, POLICE
"AFOENYI, PHYLLIS", TITLE V, PROGRAM TRAINEE I
"AGAR, BULENT B", DEPUTY COMMISSIONER, WATER MGMNT
Each of these have additional metadata so i have modeled vertex typers Employee
, Job
and Department
.
I am trying to run a query that gives me at most 20 of the police officers that have the David
in their name. This is the query I am running.
g.V().has('label', 'Employee').has('name', TextP.containing('DAVID')).as('a').outE('works_as').otherV().has('name', 'POLICE OFFICER').select('a').limit(20)
This is consuming a lot of RUs even though i am only returning 20 of them. I have modified the query slightly to flip the query order to below, but this is performing worse RU wise.
g.V().has('name', 'POLICE OFFICER').inE().outV().has('name', TextP.containing('DAVID')).limit(20)
Is there anyway I can improve this query to cost me lower RUs?