-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rest-regression aggs test (#3820)
- Loading branch information
Showing
5 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 151 additions & 0 deletions
151
quickwit/rest-api-tests/scenarii/aggregations/0001-aggregations.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# Test date histogram aggregation | ||
method: [GET] | ||
engines: | ||
- quickwit | ||
endpoint: _elastic/aggregations/_search | ||
json: | ||
query: | ||
match_all: {} | ||
aggs: | ||
date_histo: | ||
date_histogram: | ||
field: "date" | ||
fixed_interval: "30d" | ||
offset: "-4d" | ||
expected: | ||
aggregations: | ||
date_histo: | ||
buckets: | ||
- { "doc_count": 4, "key": 1420070400000.0, "key_as_string": "2015-01-01T00:00:00Z" } | ||
- { "doc_count": 2, "key": 1422662400000.0, "key_as_string": "2015-01-31T00:00:00Z" } | ||
--- | ||
# Test date histogram aggregation and sub-aggregation | ||
method: [GET] | ||
engines: | ||
- quickwit | ||
endpoint: _elastic/aggregations/_search | ||
json: | ||
query: | ||
match_all: {} | ||
aggs: | ||
date_histo: | ||
date_histogram: | ||
field: "date" | ||
fixed_interval: "30d" | ||
offset: "-4d" | ||
aggs: | ||
response: | ||
stats: | ||
field: response | ||
expected: | ||
aggregations: | ||
date_histo: | ||
buckets: | ||
- { "doc_count": 4, "key": 1420070400000.0, "key_as_string": "2015-01-01T00:00:00Z", "response": { "avg": 80.0, "count": 3, "max": 120.0, "min": 20.0, "sum": 240.0 } } | ||
- { "doc_count": 2, "key": 1422662400000.0, "key_as_string": "2015-01-31T00:00:00Z", "response": { "avg": 80.0, "count": 2, "max": 130.0, "min": 30.0, "sum": 160.0 } } | ||
--- | ||
# Test date histogram aggregation + exists and sub-aggregation | ||
method: [GET] | ||
engines: | ||
- quickwit | ||
endpoint: _elastic/aggregations/_search | ||
json: | ||
query: | ||
bool: | ||
must: | ||
- exists: | ||
field: response | ||
aggs: | ||
date_histo: | ||
date_histogram: | ||
field: "date" | ||
fixed_interval: "30d" | ||
offset: "-4d" | ||
aggs: | ||
response: | ||
stats: | ||
field: response | ||
expected: | ||
aggregations: | ||
date_histo: | ||
buckets: | ||
- { "doc_count": 3, "key": 1420070400000.0, "key_as_string": "2015-01-01T00:00:00Z", "response": { "avg": 80.0, "count": 3, "max": 120.0, "min": 20.0, "sum": 240.0 } } | ||
- { "doc_count": 2, "key": 1422662400000.0, "key_as_string": "2015-01-31T00:00:00Z", "response": { "avg": 80.0, "count": 2, "max": 130.0, "min": 30.0, "sum": 160.0 } } | ||
--- | ||
# Test term aggs | ||
method: [GET] | ||
engines: | ||
- quickwit | ||
endpoint: _elastic/aggregations/_search | ||
json: | ||
query: | ||
match_all: {} | ||
aggs: | ||
hosts: | ||
terms: | ||
field: "host" | ||
tags: | ||
terms: | ||
field: "tags" | ||
expected: | ||
aggregations: | ||
hosts: | ||
buckets: | ||
- doc_count: 3 | ||
key: 192.168.0.10 | ||
- doc_count: 2 | ||
key: 192.168.0.1 | ||
- doc_count: 1 | ||
key: 192.168.0.15 | ||
- doc_count: 1 | ||
key: 192.168.0.11 | ||
doc_count_error_upper_bound: 0 | ||
sum_other_doc_count: 0 | ||
tags: | ||
buckets: | ||
- doc_count: 4 | ||
key: nice | ||
- doc_count: 2 | ||
key: cool | ||
doc_count_error_upper_bound: 0 | ||
sum_other_doc_count: 0 | ||
--- | ||
# Test date histogram + percentiles sub-aggregation | ||
method: [GET] | ||
engines: | ||
- quickwit | ||
endpoint: _elastic/aggregations/_search | ||
json: | ||
query: | ||
match_all: {} | ||
aggs: | ||
metrics: | ||
date_histogram: | ||
field: date | ||
fixed_interval: 30d | ||
offset: "-4d" | ||
aggs: | ||
response: | ||
percentiles: | ||
field: response | ||
percents: | ||
- 85 | ||
keyed: false | ||
expected: | ||
aggregations: | ||
metrics: | ||
buckets: | ||
- doc_count: 4 | ||
key: 1420070400000.0 | ||
key_as_string: '2015-01-01T00:00:00Z' | ||
response: | ||
values: | ||
- key: 85.0 | ||
value: 100.49456770856702 | ||
- doc_count: 2 | ||
key: 1422662400000.0 | ||
key_as_string: '2015-01-31T00:00:00Z' | ||
response: | ||
values: | ||
- key: 85.0 | ||
value: 30.26717133872237 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
method: GET | ||
engines: ["quickwit"] | ||
api_root: "http://localhost:7280/api/v1/" | ||
headers: | ||
Content-Type: application/json |
47 changes: 47 additions & 0 deletions
47
quickwit/rest-api-tests/scenarii/aggregations/_setup.quickwit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Delete possibly remaining index | ||
method: DELETE | ||
endpoint: indexes/aggregations | ||
status_code: null | ||
--- | ||
# Create index | ||
method: POST | ||
endpoint: indexes/ | ||
json: | ||
version: "0.6" | ||
index_id: aggregations | ||
doc_mapping: | ||
mode: dynamic | ||
dynamic_mapping: | ||
tokenizer: default | ||
fast: true | ||
field_mappings: | ||
- name: date | ||
type: datetime | ||
input_formats: | ||
- rfc3339 | ||
precision: seconds | ||
fast: true | ||
--- | ||
# Ingest documents | ||
method: POST | ||
endpoint: aggregations/ingest | ||
num_retries: 10 | ||
params: | ||
commit: force | ||
ndjson: | ||
- {"name": "Fred", "response": 100, "id": 1, "date": "2015-01-01T12:10:30Z", "host": "192.168.0.1", "tags": ["nice"]} | ||
- {"name": "Manfred", "response": 120, "id": 13, "date": "2015-01-11T12:10:30Z", "host": "192.168.0.11", "tags": ["nice"]} | ||
- {"name": "Horst", "id": 2, "date": "2015-01-01T11:11:30Z", "host": "192.168.0.10", "tags": ["nice", "cool"]} | ||
- {"name": "Fritz", "response": 30, "id": 5, "host": "192.168.0.1", "tags": ["nice", "cool"]} | ||
--- | ||
# Ingest documents split #2 | ||
method: POST | ||
endpoint: aggregations/ingest | ||
params: | ||
commit: force | ||
ndjson: | ||
- {"name": "Werner", "response": 20, "id": 0, "date": "2015-01-02T00:00:00Z", "host": "192.168.0.10"} | ||
- {"name": "Holger", "response": 30, "id": 4, "date": "2015-02-06T00:00:00Z", "host": "192.168.0.10"} | ||
- {"name": "Bernhard", "response": 130, "id": 14, "date": "2015-02-16T00:00:00Z", "host": "192.168.0.15"} | ||
- {"name": "Fritz", "response": 30, "id": 5} | ||
|
3 changes: 3 additions & 0 deletions
3
quickwit/rest-api-tests/scenarii/aggregations/_teardown.quickwit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# # Delete index | ||
method: DELETE | ||
endpoint: indexes/aggregations |