diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-09-27 09:51:51 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-09-27 18:05:37 +0800 |
commit | eda16085a4a2e65db90d4e01e9925f86a7c479b6 (patch) | |
tree | 288810f0adb07870824e72bc0587906f6e7ca22c /dashboard/dashboard/common/elastic_access.py | |
parent | fdd68181912a81249f33903e1e1e8cb765685dbb (diff) |
only get specific docs when checking the existed ones in elasticsearch
JIRA: FUNCTEST-494
Change-Id: Ife9e37a181f13a49265a225bab72355190663f2a
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'dashboard/dashboard/common/elastic_access.py')
-rw-r--r-- | dashboard/dashboard/common/elastic_access.py | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/dashboard/dashboard/common/elastic_access.py b/dashboard/dashboard/common/elastic_access.py index b454e9a..6d82e8e 100644 --- a/dashboard/dashboard/common/elastic_access.py +++ b/dashboard/dashboard/common/elastic_access.py @@ -48,25 +48,3 @@ def get_docs(url, creds=None, body=None, field='_source'): for hit in res_data['hits']['hits']: docs.append(hit[field]) return docs - - -def get_elastic_docs_by_days(elastic_url, creds, days): - if days == 0: - body = '''{ - "query": { - "match_all": {} - } - }''' - elif days > 0: - body = '''{{ - "query" : {{ - "range" : {{ - "start_date" : {{ - "gte" : "now-{}d" - }} - }} - }} - }}'''.format(days) - else: - raise Exception('Update days must be non-negative') - return get_docs(elastic_url, creds, body) |