I am using the ES high level Java Client to make a delete index request to an AWS-hosted ElasticSearch (now called OpenSearch service). When i try to delete an index by exact name, the request is successful, but when i try to use a wildcard to delete multiple indices with a specific prefix the request fails with a "request signature does not match" exception.
Here is the delete indices code:
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest();
deleteIndexRequest.indices("index_prefix_*");
AcknowledgedResponse response = esClient.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);
Here is the exception that im getting:
o.elasticsearch.client.ResponseException: method [DELETE], host [https://[ESHost]:443], URI [/index_prefix_*?master_timeout=30s&ignore_unavailable=false&expand_wildcards=open%2Cclosed&allow_no_indices=true&timeout=30s], status line [HTTP/1.1 403 Forbidden]
{"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."}
The thing is, i have tried running similar code against a local instance of ElasticSearch and it works fine so there seems to be some issue here with trying to delete multiple indices via wildcard against the AWS-hosted ES. Anyone know how to get this to work?