def do_transform(self, request, response, config): tweet = request.entity _body = { 'query': { 'match': { 'id': tweet.id } }, 'size': request.limits.hard } res = es.search(index="twinttweets", body=_body) for hit in res['hits']['hits']: tweet = hit['_source'] r = Location() if tweet['location']: r.name = tweet['location'] response += r return response