Add support for extra elastic-search graph filter

Add the ability to add custom elastic-search query
suffix.
This is useful to better support use cases that limit
searches to e.g. specific branches.

Change-Id: Iaf28003d7a2a09e3134ed5f75c602b694efb51c6
This commit is contained in:
Ramy Asselin 2015-12-09 14:22:48 -08:00 committed by Matthew Treinish
parent 5261615d24
commit b4e3b6b928
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177

View File

@ -103,6 +103,14 @@ def main():
help='output filename. Omit for stdout')
parser.add_argument('-q', dest='queue',
help='limit results to a build queue regex')
parser.add_argument('--es-query-suffix',
help='further limit results with an '
'elastic search query suffix. This will be ANDed '
'to all queries. '
'For example, to limit all queries to a '
'specific branch use: '
' --es-query-suffix "build_branch:\\"stable/'
'liberty\\""')
parser.add_argument('-c', '--conf', help="Elastic Recheck Configuration "
"file to use for data_source options such as "
"elastic search url, logstash url, and database "
@ -153,8 +161,10 @@ def main():
for query in classifier.queries:
if args.queue:
query['query'] = query['query'] + (' AND build_queue:%s' %
args.queue)
query['query'] += ' AND build_queue:%s' % args.queue
if args.es_query_suffix:
query['query'] += ' AND (%s)' % args.es_query_suffix
if query.get('suppress-graph'):
continue
if args.verbose: