Updated example queries for ES v5
This commit is contained in:
committed by
Jason Veatch
parent
cdd1fbf6a0
commit
3401b21f1c
+6
-16
@@ -41,18 +41,16 @@ result = es.search(
|
||||
doc_type='commits',
|
||||
body={
|
||||
'query': {
|
||||
'filtered': {
|
||||
'query': {
|
||||
'bool': {
|
||||
'must': {
|
||||
'match': {'description': 'fix'}
|
||||
},
|
||||
'filter': {
|
||||
'not': {
|
||||
'must_not': {
|
||||
'term': {'files': 'test_elasticsearch'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
print_hits(result)
|
||||
|
||||
@@ -62,8 +60,8 @@ result = es.search(
|
||||
doc_type='commits',
|
||||
body={
|
||||
'query': {
|
||||
'filtered': {
|
||||
'filter': {
|
||||
'bool': {
|
||||
'must': {
|
||||
'term': {
|
||||
# parent ref is stored as type#id
|
||||
'_parent': 'repos#elasticsearch-py'
|
||||
@@ -86,22 +84,14 @@ result = es.search(
|
||||
body={
|
||||
'size': 0,
|
||||
'query': {
|
||||
'filtered': {
|
||||
'filter': {
|
||||
'has_parent': {
|
||||
'type': 'repos',
|
||||
'parent_type': 'repos',
|
||||
'query': {
|
||||
'filtered': {
|
||||
'filter': {
|
||||
'term': {
|
||||
'tags': 'python'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'aggs': {
|
||||
'committers': {
|
||||
|
||||
Reference in New Issue
Block a user