return empty if 404 and log errors

This commit is contained in:
Victor Shyba 2021-08-13 14:08:25 -03:00
parent 27598d628b
commit 7a8e8b9b47

View file

@ -178,8 +178,12 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
}
searchResult, err := search.Do(ctx) // execute
if err != nil {
log.Println(err)
if err != nil && elastic.IsNotFound(err) {
log.Println("Index returned 404! Check writer. Index: ", searchIndices)
return &pb.Outputs{}, nil
} else if err != nil {
log.Println("Error executing query: ", err)
return nil, err
}