From 5d4348b94444d477104ab1779b88e0e12b8edeeb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?France=CC=81=20Wilke?= <francewilke@gmail.com>
Date: Mon, 13 Dec 2021 11:52:15 +0200
Subject: [PATCH] Add offset to api-logs; remove relevant_id

---
 api_logs/api-logs.go       | 1 -
 search/opensearch_types.go | 1 +
 search/time_series.go      | 5 +++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/api_logs/api-logs.go b/api_logs/api-logs.go
index c569e0c..26950b4 100644
--- a/api_logs/api-logs.go
+++ b/api_logs/api-logs.go
@@ -147,7 +147,6 @@ type ApiLog struct {
 	Username            string         `json:"username,omitempty"`
 	SourceIP            string         `json:"source_ip,omitempty"`  //only logged for incoming API
 	UserAgent           string         `json:"user_agent,omitempty"` //only for incoming, indicate type of browser when UI
-	RelevantID          string         `json:"relevant_id,omitempty"`
 	Request             ApiLogRequest  `json:"request"`
 	Response            ApiLogResponse `json:"response"`
 }
diff --git a/search/opensearch_types.go b/search/opensearch_types.go
index f46a244..673ab09 100644
--- a/search/opensearch_types.go
+++ b/search/opensearch_types.go
@@ -37,6 +37,7 @@ type SearchRequestBody struct {
 	Size  int64               `json:"size,omitempty"`
 	Query Query               `json:"query"`
 	Sort  []map[string]string `json:"sort,omitempty"`
+	From  int64               `json:"from,omitempty"`
 }
 
 type Query struct {
diff --git a/search/time_series.go b/search/time_series.go
index c0eebc1..54d56b5 100644
--- a/search/time_series.go
+++ b/search/time_series.go
@@ -40,7 +40,7 @@ type TimeSeries interface {
 	//				...
 	//			}
 	//		}
-	Search(query Query, searchQuery []map[string]string, limit int64) (docs map[string]interface{}, totalCount int, err error)
+	Search(query Query, searchQuery []map[string]string, limit int64, offset int64) (docs map[string]interface{}, totalCount int, err error)
 
 	// Get takes the id returned in Search()
 	// The id is uuid assigned by OpenSearch when documents are added with Write().
@@ -398,7 +398,7 @@ type IndexSettings struct {
 //Search
 //Return:
 //	docs will be a slice of the TimeSeries data type
-func (ts *timeSeries) Search(query Query, sortQuery []map[string]string, limit int64) (docs map[string]interface{}, totalCount int, err error) {
+func (ts *timeSeries) Search(query Query, sortQuery []map[string]string, limit int64, offset int64) (docs map[string]interface{}, totalCount int, err error) {
 	if ts == nil {
 		return nil, 0, errors.Errorf("time series == nil")
 	}
@@ -421,6 +421,7 @@ func (ts *timeSeries) Search(query Query, sortQuery []map[string]string, limit i
 		Size:  limit,
 		Query: query,
 		Sort:  sortQuery,
+		From:  offset,
 	}
 
 	jsonBody, _ := json.Marshal(body)
-- 
GitLab