the rise of graph databases snippet in the following listing it' recommended not to run this code "as isin ipython (or jupyterbecause it prints every recipe key to the screen and your browser can handle only so much output either turn off the print statements or run in another python ide the code in this snippet can be found in "data preparation part pylisting importing recipe data into elasticsearch import modules from elasticsearch import elasticsearch import json client elasticsearch (indexname "gastronomicaldoctype 'recipeselasticsearch client used to communicate with database client indices create(index=indexnamecreate index file_name ' :/users/gebruiker/downloads/recipes jsonrecipemapping 'properties''name'{'type''string'}'ingredients'{'type''string'location of json recipe filechange this to match your own setupmapping for elasticsearch "recipedoctype client indices put_mapping(index=indexname,doc_type=doctype,body=recipemapping with open(file_nameencoding="utf "as data_filerecipedata json load(data_filefor recipe in recipedataprint recipe keys(print recipe['_id'keys(client index(index=indexnamedoc_type=doctype,id recipe['_id']['$oid']body={"name"recipe['name']"ingredients":recipe['ingredients']}load json recipe file into memory another way to do this would berecipedata [with open(file_nameas ffor line in frecipedata append(json loads(line)index recipes only name and ingredients are important for our use case in case timeout problem occurs it' possible to increase the timeout delay by specifyingfor exampletimeout= as an argument if everything went wellwe now have an elasticsearch index by the name "gastronomicalpopulated by thousands of recipes notice we allowed for duplicates of the same recipe by not assigning the name of the recipe to be the document key iffor