Documentation ¶
Index ¶
- Constants
- Variables
- func MakeConfig(options ...func(*opensearchutil.BulkIndexerConfig)) *opensearchutil.BulkIndexerConfig
- func NewConfig(ctx *bootstrap.ApplicationContext, di configDI) (opensearch.Config, error)
- func UnmarshalResponse[T any](resp *opensearchapi.Response) (*T, error)
- func Use()
- func WithClient(c *opensearch.Client) func(*opensearchutil.BulkIndexerConfig)
- type AfterContext
- type AfterHook
- type AfterHookBase
- type AfterHookFunc
- type BeforeContext
- type BeforeHook
- type BeforeHookBase
- type BeforeHookFunc
- type BulkAction
- type CommandType
- type HealthIndicator
- type Identifier
- type IndicesDetail
- type OpenClient
- type OpenClientImpl
- func (c *OpenClientImpl) AddAfterHook(hook AfterHook)
- func (c *OpenClientImpl) AddBeforeHook(hook BeforeHook)
- func (c *OpenClientImpl) BulkIndexer(ctx context.Context, action BulkAction, documents [][]byte, ...) (opensearchutil.BulkIndexer, error)
- func (c *OpenClientImpl) Index(ctx context.Context, index string, body io.Reader, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) IndicesCreate(ctx context.Context, index string, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) IndicesDelete(ctx context.Context, index []string, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) IndicesDeleteAlias(ctx context.Context, index []string, name []string, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) IndicesDeleteIndexTemplate(ctx context.Context, name string, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) IndicesGet(ctx context.Context, index string, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) IndicesPutAlias(ctx context.Context, index []string, name string, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) IndicesPutIndexTemplate(ctx context.Context, name string, body io.Reader, ...) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) Ping(ctx context.Context, o ...Option[opensearchapi.PingRequest]) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) RemoveAfterHook(hook AfterHook)
- func (c *OpenClientImpl) RemoveBeforeHook(hook BeforeHook)
- func (c *OpenClientImpl) Search(ctx context.Context, o ...Option[opensearchapi.SearchRequest]) (*opensearchapi.Response, error)
- func (c *OpenClientImpl) SearchTemplate(ctx context.Context, body io.Reader, ...) (*opensearchapi.Response, error)
- type Option
- type Properties
- type Repo
- type RepoImpl
- func (c *RepoImpl[T]) AddAfterHook(hook AfterHook)
- func (c *RepoImpl[T]) AddBeforeHook(hook BeforeHook)
- func (c *RepoImpl[T]) BulkIndexer(ctx context.Context, action BulkAction, bulkItems *[]T, ...) (opensearchutil.BulkIndexerStats, error)
- func (c *RepoImpl[T]) Index(ctx context.Context, index string, document T, ...) error
- func (c *RepoImpl[T]) IndicesCreate(ctx context.Context, index string, mapping interface{}, ...) error
- func (c *RepoImpl[T]) IndicesDelete(ctx context.Context, index []string, ...) error
- func (c *RepoImpl[T]) IndicesDeleteAlias(ctx context.Context, index []string, name []string, ...) error
- func (c *RepoImpl[T]) IndicesDeleteIndexTemplate(ctx context.Context, name string, ...) error
- func (c *RepoImpl[T]) IndicesGet(ctx context.Context, index string, ...) (*IndicesDetail, error)
- func (c *RepoImpl[T]) IndicesPutAlias(ctx context.Context, index []string, name string, ...) error
- func (c *RepoImpl[T]) IndicesPutIndexTemplate(ctx context.Context, name string, body interface{}, ...) error
- func (c *RepoImpl[T]) Ping(ctx context.Context, o ...Option[opensearchapi.PingRequest]) error
- func (c *RepoImpl[T]) RemoveAfterHook(hook AfterHook)
- func (c *RepoImpl[T]) RemoveBeforeHook(hook BeforeHook)
- func (c *RepoImpl[T]) Search(ctx context.Context, dest *[]T, body interface{}, ...) (hits int, err error)
- func (c *RepoImpl[T]) SearchTemplate(ctx context.Context, dest *[]T, body interface{}, ...) (hits int, err error)
- type Request
- type SearchResponse
- type TLS
- type Tracer
Constants ¶
const (
// FxGroup defines the FX group for the OpenSearch
FxGroup = "opensearch"
)
const (
PropertiesPrefix = "data.opensearch"
)
const (
UnknownCommand string = "unknown"
)
Variables ¶
var BulkIndexer = bulkCfgExt{}
var CmdToString = map[CommandType]string{ CmdSearch: "search", CmdSearchTemplate: "search template", CmdIndex: "index", CmdIndicesCreate: "indices create", CmdIndicesGet: "indices get", CmdIndicesDelete: "indices delete", CmdIndicesPutAlias: "indices put alias", CmdIndicesDeleteAlias: "indices delete alias", CmdIndicesPutIndexTemplate: "indices put index template", CmdIndicesDeleteIndexTemplate: "indices delete index template", CmdPing: "ping", CmdBulk: "bulk", }
var (
ErrCreatingNewClient = errors.New("unable to create opensearch client")
)
var (
ErrIndexNotFound = errors.New("index not found")
)
var Index = indexExt{}
var IndicesCreate = indicesCreateExt{}
var IndicesDelete = indicesDeleteExt{}
var IndicesDeleteAlias = indicesDeleteAlias{}
var IndicesDeleteIndexTemplate = indicesDeleteIndexTemplate{}
var IndicesGet = indicesGetExt{}
var IndicesPutAlias = indicesPutAlias{}
var IndicesPutIndexTemplate = indicesPutIndexTemplate{}
var Module = &bootstrap.Module{ Precedence: bootstrap.OpenSearchPrecedence, Options: []fx.Option{ appconfig.FxEmbeddedDefaults(defaultConfigFS), fx.Provide(BindOpenSearchProperties), fx.Provide(NewConfig), fx.Provide(NewClient), fx.Provide(tracingProvider()), fx.Invoke(registerHealth), }, }
var Ping = pingExt{}
var Search = searchExt{}
var SearchTemplate = searchTemplateExt{}
Functions ¶
func MakeConfig ¶
func MakeConfig(options ...func(*opensearchutil.BulkIndexerConfig)) *opensearchutil.BulkIndexerConfig
func NewConfig ¶
func NewConfig(ctx *bootstrap.ApplicationContext, di configDI) (opensearch.Config, error)
func UnmarshalResponse ¶
func UnmarshalResponse[T any](resp *opensearchapi.Response) (*T, error)
UnmarshalResponse will take the response, read the body out of it and then place the bytes that were read back into the body so it can be used again after this call
func WithClient ¶
func WithClient(c *opensearch.Client) func(*opensearchutil.BulkIndexerConfig)
Types ¶
type AfterContext ¶
type AfterContext struct { Options interface{} Resp *opensearchapi.Response Err *error // contains filtered or unexported fields }
AfterContext is the context given to a AfterHook
Options will be in the form *[]func(request *Request){} example:
options := make([]func(request *opensearchapi.SearchRequest), 0) AfterContext{Options: &options}
Resp and Err can be modified before they are returned out of Request of OpenClientImpl example being OpenClientImpl.Search
func (*AfterContext) CommandType ¶
func (c *AfterContext) CommandType() CommandType
type AfterHook ¶
type AfterHook interface {
After(ctx context.Context, after AfterContext) context.Context
}
type AfterHookBase ¶
type AfterHookBase struct { Identifier string F func(ctx context.Context, after AfterContext) context.Context }
AfterHookBase provides a way to create an AfterHook, similar to AfterHookFunc. but in a way that implements the Identifier interface so that it can be removed using the RemoveAfterHook function
func (AfterHookBase) After ¶
func (s AfterHookBase) After(ctx context.Context, after AfterContext) context.Context
func (AfterHookBase) ID ¶
func (s AfterHookBase) ID() string
type AfterHookFunc ¶
type AfterHookFunc func(ctx context.Context, after AfterContext) context.Context
AfterHookFunc provides a way to easily create a AfterHook - however hooks created in this manner are not able to be deleted from the hook slice
func (AfterHookFunc) After ¶
func (f AfterHookFunc) After(ctx context.Context, after AfterContext) context.Context
type BeforeContext ¶
type BeforeContext struct { Options interface{} // contains filtered or unexported fields }
BeforeContext is the context given to a BeforeHook
Options will be in the form *[]func(request *Request){}, example:
options := make([]func(request *opensearchapi.SearchRequest), 0) BeforeContext{Options: &options}
func (*BeforeContext) CommandType ¶
func (c *BeforeContext) CommandType() CommandType
type BeforeHook ¶
type BeforeHook interface {
Before(ctx context.Context, before BeforeContext) context.Context
}
type BeforeHookBase ¶
type BeforeHookBase struct { Identifier string F func(ctx context.Context, after BeforeContext) context.Context }
BeforeHookBase provides a way to create an BeforeHook, similar to BeforeHookFunc, but in a way that implements the Identifier interface so that it can be removed using the RemoveBeforeHook function
func (BeforeHookBase) Before ¶
func (s BeforeHookBase) Before(ctx context.Context, before BeforeContext) context.Context
func (BeforeHookBase) ID ¶
func (s BeforeHookBase) ID() string
type BeforeHookFunc ¶
type BeforeHookFunc func(ctx context.Context, before BeforeContext) context.Context
func (BeforeHookFunc) Before ¶
func (f BeforeHookFunc) Before(ctx context.Context, before BeforeContext) context.Context
type BulkAction ¶
type BulkAction string
BulkAction is intended to be used as an enum type for bulk actions
const ( BulkActionIndex BulkAction = "index" // Will add in a document and will override any duplicate (based on ID) BulkActionCreate BulkAction = "create" // Will add a document if it doesn't exist or return an error BulkActionUpdate BulkAction = "update" // Will update an existing document if it exists or return an error BulkActionDelete BulkAction = "delete" // Will delete a document if it exists or return a `not_found` )
type CommandType ¶
type CommandType int
CommandType lets the hooks know what command is being run
const ( CmdSearch CommandType = iota CmdSearchTemplate CmdIndex CmdIndicesCreate CmdIndicesGet CmdIndicesDelete CmdIndicesPutAlias CmdIndicesDeleteAlias CmdIndicesPutIndexTemplate CmdIndicesDeleteIndexTemplate CmdPing CmdBulk )
func (CommandType) String ¶
func (c CommandType) String() string
String will return the command in string format. If the command is not found the UnknownCommand string will be returned
type HealthIndicator ¶
type HealthIndicator struct {
// contains filtered or unexported fields
}
func NewHealthIndicator ¶
func NewHealthIndicator(client OpenClient) *HealthIndicator
func (*HealthIndicator) Name ¶
func (i *HealthIndicator) Name() string
type Identifier ¶
type Identifier interface {
ID() string
}
type IndicesDetail ¶
type IndicesDetail struct { Aliases map[string]interface{} `json:"aliases"` Mappings map[string]interface{} `json:"mappings"` Settings struct { Index struct { CreationDate string `json:"creation_date"` NumberOfShards string `json:"number_of_shards"` NumberOfReplicas string `json:"number_of_replicas"` Uuid string `json:"uuid"` Version struct { Created string `json:"created"` } `json:"version"` ProvidedName string `json:"provided_name"` } `json:"index"` } }
IndicesDetail response follows opensearch spec [format] https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/get-index/#response-body-fields
type OpenClient ¶
type OpenClient interface { Search(ctx context.Context, o ...Option[opensearchapi.SearchRequest]) (*opensearchapi.Response, error) SearchTemplate(ctx context.Context, body io.Reader, o ...Option[opensearchapi.SearchTemplateRequest]) (*opensearchapi.Response, error) Index(ctx context.Context, index string, body io.Reader, o ...Option[opensearchapi.IndexRequest]) (*opensearchapi.Response, error) BulkIndexer(ctx context.Context, action BulkAction, bulkItems [][]byte, o ...Option[opensearchutil.BulkIndexerConfig]) (opensearchutil.BulkIndexer, error) IndicesCreate(ctx context.Context, index string, o ...Option[opensearchapi.IndicesCreateRequest]) (*opensearchapi.Response, error) IndicesGet(ctx context.Context, index string, o ...Option[opensearchapi.IndicesGetRequest]) (*opensearchapi.Response, error) IndicesDelete(ctx context.Context, index []string, o ...Option[opensearchapi.IndicesDeleteRequest]) (*opensearchapi.Response, error) IndicesPutAlias(ctx context.Context, index []string, name string, o ...Option[opensearchapi.IndicesPutAliasRequest]) (*opensearchapi.Response, error) IndicesDeleteAlias(ctx context.Context, index []string, name []string, o ...Option[opensearchapi.IndicesDeleteAliasRequest]) (*opensearchapi.Response, error) IndicesPutIndexTemplate(ctx context.Context, name string, body io.Reader, o ...Option[opensearchapi.IndicesPutIndexTemplateRequest]) (*opensearchapi.Response, error) IndicesDeleteIndexTemplate(ctx context.Context, name string, o ...Option[opensearchapi.IndicesDeleteIndexTemplateRequest]) (*opensearchapi.Response, error) Ping(ctx context.Context, o ...Option[opensearchapi.PingRequest]) (*opensearchapi.Response, error) AddBeforeHook(hook BeforeHook) AddAfterHook(hook AfterHook) RemoveBeforeHook(hook BeforeHook) RemoveAfterHook(hook AfterHook) }
func NewClient ¶
func NewClient(di newClientDI) (OpenClient, error)
type OpenClientImpl ¶
type OpenClientImpl struct {
// contains filtered or unexported fields
}
func (*OpenClientImpl) AddAfterHook ¶
func (c *OpenClientImpl) AddAfterHook(hook AfterHook)
func (*OpenClientImpl) AddBeforeHook ¶
func (c *OpenClientImpl) AddBeforeHook(hook BeforeHook)
func (*OpenClientImpl) BulkIndexer ¶
func (c *OpenClientImpl) BulkIndexer(ctx context.Context, action BulkAction, documents [][]byte, o ...Option[opensearchutil.BulkIndexerConfig]) (opensearchutil.BulkIndexer, error)
func (*OpenClientImpl) Index ¶
func (c *OpenClientImpl) Index(ctx context.Context, index string, body io.Reader, o ...Option[opensearchapi.IndexRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) IndicesCreate ¶
func (c *OpenClientImpl) IndicesCreate( ctx context.Context, index string, o ...Option[opensearchapi.IndicesCreateRequest], ) (*opensearchapi.Response, error)
func (*OpenClientImpl) IndicesDelete ¶
func (c *OpenClientImpl) IndicesDelete(ctx context.Context, index []string, o ...Option[opensearchapi.IndicesDeleteRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) IndicesDeleteAlias ¶
func (c *OpenClientImpl) IndicesDeleteAlias(ctx context.Context, index []string, name []string, o ...Option[opensearchapi.IndicesDeleteAliasRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) IndicesDeleteIndexTemplate ¶
func (c *OpenClientImpl) IndicesDeleteIndexTemplate(ctx context.Context, name string, o ...Option[opensearchapi.IndicesDeleteIndexTemplateRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) IndicesGet ¶
func (c *OpenClientImpl) IndicesGet(ctx context.Context, index string, o ...Option[opensearchapi.IndicesGetRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) IndicesPutAlias ¶
func (c *OpenClientImpl) IndicesPutAlias(ctx context.Context, index []string, name string, o ...Option[opensearchapi.IndicesPutAliasRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) IndicesPutIndexTemplate ¶
func (c *OpenClientImpl) IndicesPutIndexTemplate(ctx context.Context, name string, body io.Reader, o ...Option[opensearchapi.IndicesPutIndexTemplateRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) Ping ¶
func (c *OpenClientImpl) Ping(ctx context.Context, o ...Option[opensearchapi.PingRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) RemoveAfterHook ¶
func (c *OpenClientImpl) RemoveAfterHook(hook AfterHook)
RemoveAfterHook will remove the given AfterHook. To ensure your hook is removable, the hook should implement the Identifier interface. If not, your hooks should be distinct in the eyes of reflect.DeepEqual, otherwise the hook will not be removed.
func (*OpenClientImpl) RemoveBeforeHook ¶
func (c *OpenClientImpl) RemoveBeforeHook(hook BeforeHook)
RemoveBeforeHook will remove the given BeforeHook. To ensure your hook is removable, the hook should implement the Identifier interface. If not, your hooks should be distinct in the eyes of reflect.DeepEqual, otherwise the hook will not be removed.
func (*OpenClientImpl) Search ¶
func (c *OpenClientImpl) Search(ctx context.Context, o ...Option[opensearchapi.SearchRequest]) (*opensearchapi.Response, error)
func (*OpenClientImpl) SearchTemplate ¶
func (c *OpenClientImpl) SearchTemplate(ctx context.Context, body io.Reader, o ...Option[opensearchapi.SearchTemplateRequest]) (*opensearchapi.Response, error)
type Properties ¶
type Properties struct { Addresses []string `json:"addresses"` Username string `json:"username"` Password string `json:"password"` TLS TLS `json:"tls"` }
func BindOpenSearchProperties ¶
func BindOpenSearchProperties(ctx *bootstrap.ApplicationContext) *Properties
func NewOpenSearchProperties ¶
func NewOpenSearchProperties() *Properties
type Repo ¶
type Repo[T any] interface { // Search will search the cluster for data. // // The data will be unmarshalled and returned to the dest argument. // The body argument should follow the Search request body [Format]. // // [Format]: https://opensearch.org/docs/latest/opensearch/rest-api/search/#request-body Search(ctx context.Context, dest *[]T, body interface{}, o ...Option[opensearchapi.SearchRequest]) (int, error) // SearchTemplate allows to use the Mustache language to pre-render a search definition // // The data will be unmarshalled and returned to the dest argument. // The body argument should follow the Search request body [Format]. // // [Format]: https://opensearch.org/docs/latest/opensearch/rest-api/search/#request-body SearchTemplate(ctx context.Context, dest *[]T, body interface{}, o ...Option[opensearchapi.SearchTemplateRequest]) (int, error) // Index will create a new Document in the index that is defined. // // The index argument defines the index name that the document should be stored in. Index(ctx context.Context, index string, document T, o ...Option[opensearchapi.IndexRequest]) error // BulkIndexer will process bulk requests of a single action type. // // The index argument defines the index name that the bulk action will target. // The action argument must be one of: ("index", "create", "delete", "update"). // The bulkItems argument is the array of struct items to be actioned. // // [Ref]: https://pkg.go.dev/github.com/opensearch-project/opensearch-go/opensearchutil#BulkIndexerItem BulkIndexer(ctx context.Context, action BulkAction, bulkItems *[]T, o ...Option[opensearchutil.BulkIndexerConfig]) (opensearchutil.BulkIndexerStats, error) // IndicesCreate will create a new index in the cluster. // // The index argument defines the index name to be created. // The mapping argument should follow the Index Create request body [Format]. // // [Format]: https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/create-index/#request-body IndicesCreate(ctx context.Context, index string, mapping interface{}, o ...Option[opensearchapi.IndicesCreateRequest]) error // IndicesGet will return information about an index // // The index argument defines the index name we want to get IndicesGet(ctx context.Context, index string, o ...Option[opensearchapi.IndicesGetRequest]) (*IndicesDetail, error) // IndicesDelete will delete an index from the cluster. // // The index argument defines the index name to be deleted. // // [Format]: https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/delete-index/ IndicesDelete(ctx context.Context, index []string, o ...Option[opensearchapi.IndicesDeleteRequest]) error // IndicesPutAlias will create or update an alias // // The index argument defines the index that the alias should point to // The name argument defines the name of the new alias // // [Format]: https://opensearch.org/docs/latest/opensearch/rest-api/alias/#request-body IndicesPutAlias(ctx context.Context, index []string, name string, o ...Option[opensearchapi.IndicesPutAliasRequest]) error // IndicesDeleteAlias deletes an alias // // The index argument defines the index that the alias points to // The name argument defines the name of the alias we would like to delete // // [Format]: https://opensearch.org/docs/latest/opensearch/rest-api/alias/#request-body IndicesDeleteAlias(ctx context.Context, index []string, name []string, o ...Option[opensearchapi.IndicesDeleteAliasRequest]) error // IndicesPutIndexTemplate will create or update an alias // // The name argument defines the name of the template // The body argument defines the specified template options to apply (refer to [Format]) // // [Format]: https://opensearch.org/docs/latest/opensearch/index-templates/#index-template-options IndicesPutIndexTemplate(ctx context.Context, name string, body interface{}, o ...Option[opensearchapi.IndicesPutIndexTemplateRequest]) error // IndicesDeleteIndexTemplate deletes an index template // // The name argument defines the name of the template to delete IndicesDeleteIndexTemplate(ctx context.Context, name string, o ...Option[opensearchapi.IndicesDeleteIndexTemplateRequest]) error // Ping will ping the OpenSearch cluster. If no error is returned, then the ping was successful Ping(ctx context.Context, o ...Option[opensearchapi.PingRequest]) error AddBeforeHook(hook BeforeHook) AddAfterHook(hook AfterHook) RemoveBeforeHook(hook BeforeHook) RemoveAfterHook(hook AfterHook) }
func NewRepo ¶
func NewRepo[T any](model *T, client OpenClient) Repo[T]
NewRepo will return a OpenSearch repository for any model type T
type RepoImpl ¶
type RepoImpl[T any] struct { // contains filtered or unexported fields }
func (*RepoImpl[T]) AddAfterHook ¶
func (*RepoImpl[T]) AddBeforeHook ¶
func (c *RepoImpl[T]) AddBeforeHook(hook BeforeHook)
func (*RepoImpl[T]) BulkIndexer ¶
func (c *RepoImpl[T]) BulkIndexer(ctx context.Context, action BulkAction, bulkItems *[]T, o ...Option[opensearchutil.BulkIndexerConfig]) (opensearchutil.BulkIndexerStats, error)
func (*RepoImpl[T]) Index ¶
func (c *RepoImpl[T]) Index(ctx context.Context, index string, document T, o ...Option[opensearchapi.IndexRequest]) error
func (*RepoImpl[T]) IndicesCreate ¶
func (c *RepoImpl[T]) IndicesCreate( ctx context.Context, index string, mapping interface{}, o ...Option[opensearchapi.IndicesCreateRequest], ) error
func (*RepoImpl[T]) IndicesDelete ¶
func (c *RepoImpl[T]) IndicesDelete(ctx context.Context, index []string, o ...Option[opensearchapi.IndicesDeleteRequest]) error
func (*RepoImpl[T]) IndicesDeleteAlias ¶
func (c *RepoImpl[T]) IndicesDeleteAlias(ctx context.Context, index []string, name []string, o ...Option[opensearchapi.IndicesDeleteAliasRequest]) error
func (*RepoImpl[T]) IndicesDeleteIndexTemplate ¶
func (c *RepoImpl[T]) IndicesDeleteIndexTemplate(ctx context.Context, name string, o ...Option[opensearchapi.IndicesDeleteIndexTemplateRequest]) error
func (*RepoImpl[T]) IndicesGet ¶
func (c *RepoImpl[T]) IndicesGet(ctx context.Context, index string, o ...Option[opensearchapi.IndicesGetRequest]) (*IndicesDetail, error)
func (*RepoImpl[T]) IndicesPutAlias ¶
func (c *RepoImpl[T]) IndicesPutAlias(ctx context.Context, index []string, name string, o ...Option[opensearchapi.IndicesPutAliasRequest], ) error
func (*RepoImpl[T]) IndicesPutIndexTemplate ¶
func (c *RepoImpl[T]) IndicesPutIndexTemplate(ctx context.Context, name string, body interface{}, o ...Option[opensearchapi.IndicesPutIndexTemplateRequest]) error
func (*RepoImpl[T]) Ping ¶
func (c *RepoImpl[T]) Ping( ctx context.Context, o ...Option[opensearchapi.PingRequest], ) error
func (*RepoImpl[T]) RemoveAfterHook ¶
func (*RepoImpl[T]) RemoveBeforeHook ¶
func (c *RepoImpl[T]) RemoveBeforeHook(hook BeforeHook)
func (*RepoImpl[T]) Search ¶
func (c *RepoImpl[T]) Search(ctx context.Context, dest *[]T, body interface{}, o ...Option[opensearchapi.SearchRequest]) (hits int, err error)
func (*RepoImpl[T]) SearchTemplate ¶
func (c *RepoImpl[T]) SearchTemplate(ctx context.Context, dest *[]T, body interface{}, o ...Option[opensearchapi.SearchTemplateRequest]) (hits int, err error)
type Request ¶
type Request interface { opensearchapi.SearchRequest | opensearchapi.SearchTemplateRequest | opensearchapi.IndicesCreateRequest | opensearchapi.IndexRequest | opensearchutil.BulkIndexerConfig | opensearchapi.IndicesDeleteRequest | opensearchapi.IndicesGetRequest | opensearchapi.IndicesPutAliasRequest | opensearchapi.IndicesDeleteAliasRequest | opensearchapi.IndicesPutIndexTemplateRequest | opensearchapi.IndicesDeleteIndexTemplateRequest | opensearchapi.PingRequest }
type SearchResponse ¶
type SearchResponse[T any] struct { Took int `json:"took"` TimedOut bool `json:"timed_out"` Shards struct { Total int `json:"total"` Successful int `json:"successful"` Skipped int `json:"skipped"` Failed int `json:"failed"` } `json:"_shards"` Hits struct { MaxScore float64 `json:"max_score"` Total struct { Value int `json:"value"` } `json:"total"` Hits []struct { Index string `json:"_index"` ID string `json:"_id"` Score float64 `json:"_score"` Source T `json:"_source"` } `json:"hits"` } `json:"hits"` }
SearchResponse modeled after https://opensearch.org/docs/latest/opensearch/rest-api/search/#response-body
type TLS ¶
type TLS struct { Enable bool `json:"enable"` Certs certs.SourceProperties `json:"certs"` }