The better way to do 5 million queries is to not do 5 million queries to neo4j. :).
The better way would be to use something like the neo4j spark connector. Use 1 cypher query to pull all of the data you need from Neo4j into a single DataFrame, and then use standard Spark SQL to join that resulting dataframe to the data that you have.
That's 1 big query pulling 5 million results, which you can then further partition and join in spark.