connected data examplea recipe recommendation engine instancea recipe is called "lasagnathen this can be salmon lasagnabeef lasagnachicken lasagnaor any other type no single recipe is selected as the prototype lasagnathey are all uploaded to elasticsearch under the same name"lasagnathis is choiceso feel free to decide otherwise it will have significant impactas we'll see later on the door is now open for systematic upload to our local graph database make sure your local graph database instance is turned on when applying the following code our username for this database is the default neo and the password is neo jamake sure to adjust this for your local setup for this we'll also require neo -specific python library called py neo if you haven' alreadynow would be the time to install it to your virtual environment using pip install py neo or conda install py neo when using anaconda againbe advised this code will crash your browser when run directly in ipython or jupiter the code in this listing can be found in "data preparation part pylisting using the elasticsearch index to fill the graph database from elasticsearch import elasticsearch from py neo import graphauthenticatenoderelationship client elasticsearch (indexname "gastronomicaldoctype 'recipesgraph database entity elasticsearch client used to communicate with database authenticate("localhost: ""user""password"graph_db graph("filename ' :/users/gebruiker/downloads/ingredients txtingredients =[with open(filenameas ffor line in fingredients append(line strip()authenticate with your own username and password ingredients text file gets loaded into memory strip because of the / you get otherwise from reading the txt print ingredients ingredientnumber grandtotal for ingredient in ingredientsimport modules loop through ingredients and fetch elasticsearch result tryingredientnode graph_db merge_one("ingredient","name",ingredientexceptcontinue ingredientnumber += searchbody "size "query""match_phrase""ingredients":create node in graph database for current ingredient phrase matching usedas some ingredients consist of multiple words