|
| 1 | +setup: |
| 2 | + - do: |
| 3 | + indices.create: |
| 4 | + index: test_data_2023 |
| 5 | + body: |
| 6 | + mappings: |
| 7 | + properties: |
| 8 | + "@timestamp": |
| 9 | + type: date |
| 10 | + "packets": |
| 11 | + type: integer |
| 12 | + - do: |
| 13 | + bulk: |
| 14 | + index: test_data_2023 |
| 15 | + refresh: true |
| 16 | + body: |
| 17 | + - '{"index":{}}' |
| 18 | + - '{"@timestamp":"2023-10-08T10:00:00.000Z","packets":10}' |
| 19 | + - '{"index":{}}' |
| 20 | + - '{"@timestamp":"2023-10-08T10:00:00.500Z","packets":15}' |
| 21 | + - '{"index":{}}' |
| 22 | + - '{"@timestamp":"2023-10-08T10:00:01.000Z","packets":20}' |
| 23 | + - '{"index":{}}' |
| 24 | + - '{"@timestamp":"2023-10-08T10:00:01.500Z","packets":25}' |
| 25 | + - '{"index":{}}' |
| 26 | + - '{"@timestamp":"2023-10-08T10:00:02.000Z","packets":30}' |
| 27 | + |
| 28 | +--- |
| 29 | +"timechart with millisecond span": |
| 30 | + - skip: |
| 31 | + features: |
| 32 | + - headers |
| 33 | + - allowed_warnings |
| 34 | + - do: |
| 35 | + headers: |
| 36 | + Content-Type: 'application/json' |
| 37 | + ppl: |
| 38 | + body: |
| 39 | + query: source=test_data_2023 | timechart span=500ms count() |
| 40 | + |
| 41 | + - match: { total: 5 } |
| 42 | + - match: { "schema": [ { "name": "@timestamp", "type": "timestamp" }, { "name": "count", "type": "bigint" }] } |
| 43 | + - match: {"datarows": [["2023-10-08 10:00:00", 1], ["2023-10-08 10:00:00.5", 1], ["2023-10-08 10:00:01", 1], ["2023-10-08 10:00:01.5", 1], ["2023-10-08 10:00:02", 1]]} |
| 44 | + |
| 45 | +--- |
| 46 | +"timechart with millisecond span and per_second function": |
| 47 | + - skip: |
| 48 | + features: |
| 49 | + - headers |
| 50 | + - allowed_warnings |
| 51 | + - do: |
| 52 | + headers: |
| 53 | + Content-Type: 'application/json' |
| 54 | + ppl: |
| 55 | + body: |
| 56 | + query: source=test_data_2023 | timechart span=1000ms per_second(packets) |
| 57 | + |
| 58 | + - match: { total: 3 } |
| 59 | + - match: { "schema": [ { "name": "@timestamp", "type": "timestamp" }, { "name": "per_second(packets)", "type": "double" }] } |
| 60 | + - match: {"datarows": [["2023-10-08 10:00:00", 25.0], ["2023-10-08 10:00:01", 45.0], ["2023-10-08 10:00:02", 30.0]]} |
| 61 | + |
| 62 | +--- |
| 63 | +"timechart with milliseconds": |
| 64 | + - skip: |
| 65 | + features: |
| 66 | + - headers |
| 67 | + - allowed_warnings |
| 68 | + - do: |
| 69 | + headers: |
| 70 | + Content-Type: 'application/json' |
| 71 | + ppl: |
| 72 | + body: |
| 73 | + query: source=test_data_2023 | timechart span=250milliseconds count() |
| 74 | + |
| 75 | + - match: { total: 5 } |
| 76 | + - match: { "schema": [ { "name": "@timestamp", "type": "timestamp" }, { "name": "count", "type": "bigint" }] } |
| 77 | + |
| 78 | +--- |
| 79 | +"timechart with second span for comparison": |
| 80 | + - skip: |
| 81 | + features: |
| 82 | + - headers |
| 83 | + - allowed_warnings |
| 84 | + - do: |
| 85 | + headers: |
| 86 | + Content-Type: 'application/json' |
| 87 | + ppl: |
| 88 | + body: |
| 89 | + query: source=test_data_2023 | timechart span=1s count() |
| 90 | + |
| 91 | + - match: { total: 3 } |
| 92 | + - match: { "schema": [ { "name": "@timestamp", "type": "timestamp" }, { "name": "count", "type": "bigint" }] } |
| 93 | + - match: {"datarows": [["2023-10-08 10:00:00", 2], ["2023-10-08 10:00:01", 2], ["2023-10-08 10:00:02", 1]]} |
0 commit comments