the rise of graph databases "query":ingredientresult client search(index=indexname,doc_type=doctype,body=searchbodyprint ingredient print ingredientnumber print "totalstr(result['hits']['total']grandtotal grandtotal result['hits']['total'print "grand totalstr(grandtotalfor recipe in result['hits']['hits']loop through recipes found for this particular ingredient trycreate relationship between this recipe and ingredient recipenode graph_db merge_one("recipe","name",recipe['_source']['name']nodesrelationship relationship(recipenode"contains"ingredientnodegraph_db create_unique(nodesrelationshipprint "addedrecipe['_source']['name'contains ingredient exceptcontinue create node for each recipe that is not already in graph database print "*************************************greatwe're now the proud owner of graph database filled with recipesit' time for connected data exploration step data exploration now that we have our data where we want itwe can manually explore it using the neo interface at nothing stops you from running your cypher code in this environmentbut cypher can also be executed via the py neo library one interesting question we can pose is which ingredients are occurring the most over all recipeswhat are we most likely to get into our digestive system if we randomly selected and ate dishes from this databasefrom py neo import graphauthenticatenoderelationship authenticate("localhost: ""user""password"graph_db graph("match (rec:recipe)-[ :contains]->(ing:ingredientwith ingcount(ras num return ing name as namenum order by num desc limit ;"