-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
31 lines (22 loc) · 788 Bytes
/
test.py
File metadata and controls
31 lines (22 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from elasticsearch import Elasticsearch
es = Elasticsearch(['http://10.65.202.168'])
query={"query" : {"match_all" : {}}}
"""
response= es.search(index="products", doc_type="product", body=query)
for hit in response["hits"]["hits"]:
print hit
"""
scanResp= es.search(index="products", doc_type="product", body=query, search_type="scan", scroll="10m")
scrollId= scanResp['_scroll_id']
print scrollId
#response['hits']['hits'][0]['_source']['epid']
response=es.scroll(scroll_id=scrollId, scroll= "10m")
print response
response=es.scroll(scroll_id=scrollId, scroll= "10m")
print response
"""
from elasticsearch.helpers import scan
scanResp=scan(client=es, query=query, scroll= "10m", index="products", doc_type="product", timeout="10m")
for resp in scanResp:
print resp
"""