Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import http.client
import json
conn = http.client.HTTPConnection("localhost:9200")
conn.request("GET", "/my_index/_search?size=10000")
r1 = conn.getresponse()
result = json.loads(r1.read().decode('utf-8'))
for hit in result["hits"]["hits"]:
print(json.dumps({ "index" : { "_type": hit["_type"], "_id" : hit["_id"] }}))
print(json.dumps(hit["_source"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.