From ccc6ba1e809673d6ca95b1c4953f242500f3318c Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Fri, 17 Jul 2020 18:14:09 +0800 Subject: [PATCH] ignore unavailable index Signed-off-by: wanjunlei --- pkg/simple/client/auditing/elasticsearch/clients.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/simple/client/auditing/elasticsearch/clients.go b/pkg/simple/client/auditing/elasticsearch/clients.go index e80fee34c..b9bf90575 100644 --- a/pkg/simple/client/auditing/elasticsearch/clients.go +++ b/pkg/simple/client/auditing/elasticsearch/clients.go @@ -57,7 +57,7 @@ func (e Error) Error() string { type ClientV5 es5.Client func (c *ClientV5) ExSearch(r *Request) (*Response, error) { - return c.parse(c.Search(c.Search.WithIndex(r.Index), c.Search.WithBody(r.Body))) + return c.parse(c.Search(c.Search.WithIndex(r.Index), c.Search.WithBody(r.Body), c.Search.WithIgnoreUnavailable(true))) } func (c *ClientV5) parse(resp *es5api.Response, err error) (*Response, error) { if err != nil { @@ -105,7 +105,7 @@ func (c *ClientV5) Version() (string, error) { type ClientV6 es6.Client func (c *ClientV6) ExSearch(r *Request) (*Response, error) { - return c.parse(c.Search(c.Search.WithIndex(r.Index), c.Search.WithBody(r.Body))) + return c.parse(c.Search(c.Search.WithIndex(r.Index), c.Search.WithBody(r.Body), c.Search.WithIgnoreUnavailable(true))) } func (c *ClientV6) parse(resp *es6api.Response, err error) (*Response, error) { if err != nil { @@ -136,7 +136,7 @@ func (c *ClientV6) parse(resp *es6api.Response, err error) (*Response, error) { type ClientV7 es7.Client func (c *ClientV7) ExSearch(r *Request) (*Response, error) { - return c.parse(c.Search(c.Search.WithIndex(r.Index), c.Search.WithBody(r.Body))) + return c.parse(c.Search(c.Search.WithIndex(r.Index), c.Search.WithBody(r.Body), c.Search.WithIgnoreUnavailable(true))) } func (c *ClientV7) parse(resp *es7api.Response, err error) (*Response, error) { if err != nil {