From 68d77db15fb70eed50e23c7959396cf2c722a482 Mon Sep 17 00:00:00 2001 From: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com> Date: Fri, 29 Dec 2023 13:51:05 +0800 Subject: [PATCH] docker: allows elasticsearch8 tests to delete with wildcards (#3665) Signed-off-by: Adrian Cole --- .../zipkin-elasticsearch8/config/elasticsearch.yml | 3 +++ .../main/java/zipkin2/elasticsearch/ElasticsearchStorage.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/test-images/zipkin-elasticsearch8/config/elasticsearch.yml b/docker/test-images/zipkin-elasticsearch8/config/elasticsearch.yml index f95e6d1a103..e69970ddc6c 100644 --- a/docker/test-images/zipkin-elasticsearch8/config/elasticsearch.yml +++ b/docker/test-images/zipkin-elasticsearch8/config/elasticsearch.yml @@ -19,3 +19,6 @@ xpack.security.enabled: false xpack.ml.enabled: false cluster.initial_master_nodes: - zipkin-elasticsearch +# This is a test image, so we are not afraid to delete all indices. Avoids: +# Wildcard expressions or all indices are not allowed +action.destructive_requires_name: false diff --git a/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchStorage.java b/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchStorage.java index a8ff6e5de6c..9207fd47c12 100644 --- a/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchStorage.java +++ b/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/ElasticsearchStorage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 The OpenZipkin Authors + * Copyright 2015-2023 The OpenZipkin Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at @@ -268,6 +268,8 @@ public void clear() throws IOException { Set toClear = new LinkedHashSet<>(); toClear.add(indexNameFormatter().formatType(TYPE_SPAN)); toClear.add(indexNameFormatter().formatType(TYPE_DEPENDENCY)); + // Note: Elasticsearch 8.x requires this config to clear with wildcards: + // action.destructive_requires_name: false for (String index : toClear) clear(index); }