From 7342f2057b1d8a25adb83454d38a6adae5beb1de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?France=CC=81=20Wilke?= <francewilke@gmail.com>
Date: Mon, 13 Dec 2021 21:42:57 +0200
Subject: [PATCH] Api logs wildcard search

---
 search/opensearch_types.go | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/search/opensearch_types.go b/search/opensearch_types.go
index a8d1880..d2ae209 100644
--- a/search/opensearch_types.go
+++ b/search/opensearch_types.go
@@ -48,6 +48,7 @@ type Query struct {
 	MultiMatch  *QueryMultiMatch `json:"multi_match,omitempty"`
 	Bool        *QueryBool       `json:"bool,omitempty"`
 	QueryString *QueryString     `json:"query_string,omitempty"`
+	Wildcard    *QueryNameValue  `json:"wildcard,omitempty"` //https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html
 }
 
 type QueryMultiMatch struct {
@@ -56,7 +57,8 @@ type QueryMultiMatch struct {
 }
 
 type QueryString struct {
-	Query string `json:"query" doc:"Text search with partial matches, using asterisk for optional or question mark for required wildcards before and/or after text"`
+	Query  string   `json:"query" doc:"Text search with partial matches, using asterisk for optional or question mark for required wildcards before and/or after text"`
+	Fields []string `json:"fields,omitempty" doc:"List of fields"`
 }
 
 // https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html
@@ -72,10 +74,15 @@ type QueryBool struct {
 type QueryNameValue map[string]QueryValue
 
 type QueryValue struct {
-	Query          string `json:"query"`
+	Query          string `json:"query,omitempty"`
 	Operator       string `json:"operator,omitempty"`  //defaults to "or", accepted values: or|and
 	Fuzziness      string `json:"fuzziness,omitempty"` //https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#fuzziness
 	ZeroTermsQuery string `json:"zero_terms_query,omitempty"`
+	Value          string `json:"value,omitempty"` //https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html
+}
+
+func QueryValueTextValue(text string) QueryValue {
+	return QueryValue{Value: text}
 }
 
 func QueryValueText(text string) QueryValue {
-- 
GitLab