Autopurge of Elasticsearch index when exceed the hard disk size using bash script
Seems it is a problem with quoting - combination with single quote, double quote and escaping . Curl send json data. Bash variable should be in double quotes but json data should start with single quote.
Example:
data="'"'{"json": "finish string after single quote ->", '"\"$BASH_VAR\""',"json1": "finish data"}'"'"
In above example I used concatenate strings in single quote and double quote ("'"'{..'
for '
add to {..
).
Try something like this in bash script
curl -XDELETE 'index name/_query' -d "'"' { "query": { "range": { "eventType_timestamp": { "gte": '"\"$from_dataset_date\""', "lte": $to_dataset_date } } } }'"'"