|
@@ -1,5 +1,6 @@
|
|
package org.jetlinks.community.elastic.search.utils;
|
|
package org.jetlinks.community.elastic.search.utils;
|
|
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.elasticsearch.ElasticsearchStatusException;
|
|
import org.elasticsearch.ElasticsearchStatusException;
|
|
import org.elasticsearch.action.ActionListener;
|
|
import org.elasticsearch.action.ActionListener;
|
|
import org.hswebframework.web.exception.BusinessException;
|
|
import org.hswebframework.web.exception.BusinessException;
|
|
@@ -8,7 +9,7 @@ import reactor.core.publisher.Mono;
|
|
import java.util.function.Consumer;
|
|
import java.util.function.Consumer;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
|
|
|
|
-
|
|
|
|
|
|
+@Slf4j
|
|
public class ReactorActionListener {
|
|
public class ReactorActionListener {
|
|
|
|
|
|
public static <R, T> Mono<R> mono(Consumer<ActionListener<T>> listenerConsumer,
|
|
public static <R, T> Mono<R> mono(Consumer<ActionListener<T>> listenerConsumer,
|
|
@@ -38,6 +39,11 @@ public class ReactorActionListener {
|
|
}).flatMap(Function.identity())
|
|
}).flatMap(Function.identity())
|
|
.onErrorResume(ElasticsearchStatusException.class, e -> {
|
|
.onErrorResume(ElasticsearchStatusException.class, e -> {
|
|
if (e.status().getStatus() == 404) {
|
|
if (e.status().getStatus() == 404) {
|
|
|
|
+ if(e.getMessage().contains("index_not_found_exception")){
|
|
|
|
+ log.debug("{}",e.getMessage());
|
|
|
|
+ }else{
|
|
|
|
+ log.warn("{}",e.getDetailedMessage(),e);
|
|
|
|
+ }
|
|
return Mono.empty();
|
|
return Mono.empty();
|
|
}
|
|
}
|
|
return Mono.error(new BusinessException(e.getMessage(), e));
|
|
return Mono.error(new BusinessException(e.getMessage(), e));
|