Reputation: 11397
Using the debug console, I've arrived at the "result" i want. I achieved it using:
response.hits.hits[0]._source
So i took it one step further and decided to create a loop:
projection = []
for hit in response.hits:
for subHit in hit.hits:
projection.append(subHit._source)
but now i'm getting a exeception stating that subHit
does not have hits
property... and I'm confused...
What am I doing wrong?
Upvotes: 0
Views: 29
Reputation: 2182
Looks like your response.hits
is not an array but response.hits.hits
is an array. So you must be just doing like,
for hit in response.hits.hits:
projection.append(hit._source)
Upvotes: 1