Last active
July 17, 2023 17:30
-
-
Save R4wm/4cef4ea7e69d3d341f838c86dba7e772 to your computer and use it in GitHub Desktop.
create indexes in elasticsearch
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
#!/bin/bash | |
today=date "+%Y.%m.%d" | |
soc_prefix="soc-" | |
bot_prefix="bot_event-" | |
rate_limits_prefix="rate_limits-" | |
rate_limiting_enforcer_prefix="rate_limiting_enforcer-" | |
postfix="-000001" | |
for i in {1..61}; do | |
next_date=$(date -I -d "$today -$i days") | |
next_date=$(echo $next_date | sed 's/-/./g') | |
# ISO 8601 (e.g. 2020-02-20) using -I | |
#date -I -d "$today -$i days" | |
soc=$soc_prefix$next_date$postfix | |
bot=$bot_prefix$next_date$postfix | |
rl=$rate_limits_prefix$next_date$postfix | |
rle=$rate_limiting_enforcer_prefix$next_date$postfix | |
echo "$soc" | |
echo "$bot" | |
echo "$rl" | |
echo "$rle" | |
curl -XPUT -H"content-type: application/json" localhost:9200/$soc | |
curl -XPUT -H"content-type: application/json" localhost:9200/$bot | |
curl -XPUT -H"content-type: application/json" localhost:9200/$rl | |
curl -XPUT -H"content-type: application/json" localhost:9200/$rle | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment