Last active
June 1, 2021 16:01
-
-
Save FrankHassanabad/55013baee6a31aaab47ccd1fd252e309 to your computer and use it in GitHub Desktop.
Perf testing across const keyword and regular keyword and aliases
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
```json | |
# Adds an index for testing where we can test across: | |
# * keyword | |
# * const keyword | |
# * And a corner case where someone reindexes non-compatible const data into const data from _source. | |
DELETE const-logs-frank-delme-2 | |
PUT const-logs-frank-delme-2 | |
{ | |
"mappings": { | |
"dynamic": "false", | |
"properties": { | |
"@timestamp": { | |
"type": "date" | |
}, | |
"message": { | |
"type": "text" | |
}, | |
"host": { | |
"properties": { | |
"name": { | |
"type": "keyword" | |
} | |
} | |
} | |
} | |
} | |
} | |
# Re-index two auditbeat indexes from estc to get us close to 1 million records for a profile run | |
POST _reindex?wait_for_completion=false | |
{ | |
"source": { | |
"index": "auditbeat-8.0.0-2021.04.26-000007,auditbeat-8.0.0-2021.05.26-000008" | |
}, | |
"dest": { | |
"index": "const-logs-frank-delme-2" | |
} | |
} | |
# Count should around 941,317 once indexing is complete. | |
GET const-logs-frank-delme-2/_count | |
# We add a constant keyword to the mapping of "event.module" | |
# to profile against other indexes where "event.module" is a keyword instead | |
# of a constant and to test queries between these two. | |
PUT const-logs-frank-delme-2/_mapping | |
{ | |
"properties": { | |
"event": { | |
"properties": { | |
"module": { | |
"type": "constant_keyword", | |
"value": "endpoint" | |
} | |
} | |
} | |
} | |
} | |
# Aggs should always return "endpoint" from "const-logs-frank-delme-2" and then others | |
# from "logs-*" and mix them together in the aggs query | |
GET const-logs-frank-delme-2,logs-*/_search?request_cache=false&human=true | |
{ | |
"size": 0, | |
"profile": true, | |
"track_total_hits": false, | |
"aggs": { | |
"event_module": { | |
"terms": { | |
"field": "event.module" | |
} | |
} | |
} | |
} | |
# Adds the slower runtime into the mix to ensure performance for the specific const is not reduced | |
GET const-logs-frank-delme-1,const-logs-frank-delme-2,auditbeat-8.0.0-2021.04.26-000007/_search?request_cache=false&human=true | |
{ | |
"size": 0, | |
"profile": true, | |
"track_total_hits": false, | |
"aggs": { | |
"event_module": { | |
"terms": { | |
"field": "event.module" | |
} | |
} | |
} | |
} | |
``` |
Author
FrankHassanabad
commented
Jun 1, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment