From 96ee9e91469cefdc71febf557dff9986d229db8e Mon Sep 17 00:00:00 2001 From: Haiyan Meng Date: Fri, 17 Jan 2020 15:49:14 -0800 Subject: [PATCH] Add curl ElasticSearch cmd for using `filter` and `range` together --- .../crawl/search_cmds/creationTime.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/api/internal/crawl/search_cmds/creationTime.md b/api/internal/crawl/search_cmds/creationTime.md index e83165efe..d7eafdc45 100644 --- a/api/internal/crawl/search_cmds/creationTime.md +++ b/api/internal/crawl/search_cmds/creationTime.md @@ -87,6 +87,30 @@ curl -X GET "${ElasticSearchURL}:9200/${INDEXNAME}/_search?pretty" -H 'Content-T ' ``` +Query all the kustomization files whose `creationTime` falls within the specific range: +``` +curl -X GET "${ElasticSearchURL}:9200/${INDEXNAME}/_search?pretty" -H 'Content-Type: application/json' -d' +{ + "size": 20, + "query": { + "bool": { + "filter": { + "regexp": { "filePath": "(.*/)?kustomization((.yaml)?|(.yml)?)(/)*" } + }, + "must": { + "range": { + "creationTime": { + "gte": "2017-09-24T15:49:57.000Z", + "lte": "2017-09-24T15:49:57.000Z" + } + } + } + } + } +} +' +``` + Aggregate how many new kustomization files were added into Github each month: ``` curl -X GET "${ElasticSearchURL}:9200/${INDEXNAME}/_search?size=0&pretty" -H 'Content-Type: application/json' -d'