February 2018
Beginner to intermediate
364 pages
10h 32m
English
We proceed with the recipe as follows:
$ python elasticcloud_starwars.py
from elasticsearch import Elasticsearchimport requestsimport jsonif __name__ == '__main__': es = Elasticsearch( [ "https://elastic:tduhdExunhEWPjSuH73O6yLS@d7c72d3327076cc4daf5528103c46a27.us-west-2.aws.found.io:9243" ])i = 1while i<20: r = requests.get('http://swapi.co/api/people/' + str(i)) if r.status_code is not 200: print("Got a " + str(r.status_code) + " so stopping") break j = json.loads(r.content) print(i, j) #es.index(index='sw', doc_type='people', ...
Read now
Unlock full access