Created
March 14, 2018 07:31
-
-
Save skade/1d97439807233b018e91f2b4ea0cc1d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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