I was using this curl
command line to clean my indices:
curl -XDELETE http://example.com/my_index-*
But, now, I want to delete my_index-.*[.][0-3][0-9]
:
- to delete only
my_index-YYYY.MM.dd
- to keep
my_index-YYYY.MM.dd-*
The relevant Elasticsearch documentation I have found:
Delete index API does say nothing on regex.
Multiple indices says:
It also support wildcards, for example:
test*
or*test
orte*t
or*test*
, and the ability to "add" (+
) and "remove" (-
), for example:+test*,-test3
.Date math support in index names says:
Almost all APIs that have an
index
parameter, support date math in theindex
parameter value.
[...]
date_format
is the optional format in which the computed date should be rendered. Defaults toYYYY.MM.dd
.
My Questions:
- Is it possible to send a
DELETE
request method to Elasticsearch HTTP server to delete indices only formattedmy_index-YYYY.MM.dd
? - Or the inverse, to delete all
my_index-*
but keepingmy_index-*-*
?
For example, regex can sometimes be provided within the POST
data:
curl -XPOST http://example.com/my_index-2017.07.14/_search?pretty' -H 'Content-Type: application/json' -d'
{
"suggest": {
"song-suggest" : {
"regex" : "n[ever|i]r",
"completion" : {
"field" : "suggest"
}
}
}
}'