update example directory to work with Es 7

This commit is contained in:
Nick Lang
2019-05-11 09:41:48 -06:00
parent c4f0454285
commit 8ab66b9bde
2 changed files with 16 additions and 26 deletions
+3 -4
View File
@@ -9,7 +9,9 @@ from elasticsearch import Elasticsearch
def print_search_stats(results):
print("=" * 80)
print("Total %d found in %dms" % (results["hits"]["total"], results["took"]))
print(
"Total %d found in %dms" % (results["hits"]["total"]["value"], results["took"])
)
print("-" * 80)
@@ -49,7 +51,6 @@ print_hits(es.search(index="git"))
print('Find commits that says "fix" without touching tests:')
result = es.search(
index="git",
doc_type="doc",
body={
"query": {
"bool": {
@@ -64,7 +65,6 @@ print_hits(result)
print("Last 8 Commits for elasticsearch-py:")
result = es.search(
index="git",
doc_type="doc",
body={
"query": {"term": {"repository": "elasticsearch-py"}},
"sort": [{"committed_date": {"order": "desc"}}],
@@ -76,7 +76,6 @@ print_hits(result)
print("Stats for top 10 committers:")
result = es.search(
index="git",
doc_type="doc",
body={
"size": 0,
"aggs": {