Updated example queries for ES v5

This commit is contained in:
Jason Veatch
2016-12-01 13:47:08 -05:00
committed by Jason Veatch
parent cdd1fbf6a0
commit 3401b21f1c
+6 -16
View File
@@ -41,18 +41,16 @@ result = es.search(
doc_type='commits', doc_type='commits',
body={ body={
'query': { 'query': {
'filtered': { 'bool': {
'query': { 'must': {
'match': {'description': 'fix'} 'match': {'description': 'fix'}
}, },
'filter': { 'must_not': {
'not': {
'term': {'files': 'test_elasticsearch'} 'term': {'files': 'test_elasticsearch'}
} }
} }
} }
} }
}
) )
print_hits(result) print_hits(result)
@@ -62,8 +60,8 @@ result = es.search(
doc_type='commits', doc_type='commits',
body={ body={
'query': { 'query': {
'filtered': { 'bool': {
'filter': { 'must': {
'term': { 'term': {
# parent ref is stored as type#id # parent ref is stored as type#id
'_parent': 'repos#elasticsearch-py' '_parent': 'repos#elasticsearch-py'
@@ -86,22 +84,14 @@ result = es.search(
body={ body={
'size': 0, 'size': 0,
'query': { 'query': {
'filtered': {
'filter': {
'has_parent': { 'has_parent': {
'type': 'repos', 'parent_type': 'repos',
'query': { 'query': {
'filtered': {
'filter': {
'term': { 'term': {
'tags': 'python' 'tags': 'python'
} }
} }
} }
}
}
}
}
}, },
'aggs': { 'aggs': {
'committers': { 'committers': {