From 2372c06fd9d178ad65dd26a0ee63109e858fd64a Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Tue, 17 May 2022 14:24:35 +0800 Subject: [PATCH] Storage(ElasticSearch): add search options to tolerate inexisting indices (#9076) --- docs/en/changes/changes.md | 1 + .../library/client/elasticsearch/ElasticSearchClient.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index aabac94d9f93..eefb4a096308 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -56,6 +56,7 @@ * Remove unnecessary `onCompleted` on gRPC `onError` callback. * Remove `Layer` concept form `Process`. * Update to list all eBPF profiling schedulers without duration. +* Storage(ElasticSearch): add search options to tolerate inexisting indices. #### UI diff --git a/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java b/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java index 482ed58745eb..44440d67fc02 100644 --- a/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java +++ b/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java @@ -253,9 +253,13 @@ public SearchResponse search(Supplier indices, Search search) { Arrays.stream(indices.get()) .map(indexNameConverter) .toArray(String[]::new); + final SearchParams params = new SearchParams() + .allowNoIndices(true) + .ignoreUnavailable(true) + .expandWildcards("open"); return es.get().search( search, - null, + params, indexNames); }