The JobListingSkills API implementation follows a slightly different pattern. The following is its code:
class JobListingSkills(Resource): def get(self, job_listing_id): print("Request for job listing's skills with id: " + job_listing_id) es = Elasticsearch() if (es.exists(index='joblistings', doc_type='job-listing', id=job_listing_id)): print('Found the document in ElasticSearch') doc = es.get(index='joblistings', doc_type='job-listing', id=job_listing_id) return doc['_source']['JSON']['skills'] skills = get_job_listing_skills(job_listing_id) print("Got the following skills as a response: " + skills) return skills
This implementation only uses ElasticSearch to the extent of checking if the document already is in ElasticSearch. ...