From 99eb8936a30a03c78b58451ee90d5673aab979ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Mon, 9 Dec 2013 17:48:54 +0100 Subject: [PATCH] Another example query, this time with an actual query --- example/queries.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/example/queries.py b/example/queries.py index 013f1b34..43b1cb1c 100644 --- a/example/queries.py +++ b/example/queries.py @@ -37,6 +37,27 @@ es = Elasticsearch() print('Empty search:') print_hits(es.search(index='git')) +print('Find commits that says "fix" without touching tests:') +result = es.search( + index='git', + doc_type='commits', + body={ + 'query': { + 'filtered': { + 'query': { + 'match': {'description': 'fix'} + }, + 'filter': { + 'not': { + 'term': {'files': 'test_elasticsearch'} + } + } + } + } + } +) +print_hits(result) + print('Last 8 Commits for elasticsearch-py:') result = es.search( index='git',