Skip to content

Instantly share code, notes, and snippets.

@markuskont
Created December 15, 2016 10:28
Show Gist options
  • Save markuskont/1cfffc8c813806364200ecf2fa7eaaad to your computer and use it in GitHub Desktop.
Save markuskont/1cfffc8c813806364200ecf2fa7eaaad to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from elasticsearch import Elasticsearch
import json
ES_INDEX='stackoverflow-surveys-2016'
es = Elasticsearch(hosts=['192.168.56.201'])
results = es.search(index=ES_INDEX, q='*', size=1)
for key, value in results['hits'].items():
if key == 'hits':
print(json.dumps(value, sort_keys=True, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment