Documentation
¶
Index ¶
- func NewSearcher(ctx context.Context, config Config) (port.ResourceSearcher, error)
- type AggregationBucket
- type AggregationResponse
- type Config
- type CountResponse
- type Hit
- type Hits
- type OpenSearchClientRetriever
- type OpenSearchSearcher
- func (o *OpenSearchSearcher) IsReady(ctx context.Context) error
- func (os *OpenSearchSearcher) QueryResources(ctx context.Context, criteria model.SearchCriteria) (*model.SearchResult, error)
- func (os *OpenSearchSearcher) QueryResourcesCount(ctx context.Context, publicCountCriteria model.SearchCriteria, ...) (*model.CountResult, error)
- func (os *OpenSearchSearcher) Render(ctx context.Context, criteria model.SearchCriteria) ([]byte, error)
- type SearchResponse
- type TermsAggregation
- type Total
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSearcher ¶
NewSearcher returns a new OpenSearchSearcher implementation
Types ¶
type AggregationBucket ¶ added in v0.4.5
AggregationBucket represents a single aggregation bucket.
type AggregationResponse ¶ added in v0.4.5
type AggregationResponse struct {
GroupBy TermsAggregation `json:"group_by"`
}
AggregationResponse represents the aggregations in a search response.
type CountResponse ¶ added in v0.4.5
type CountResponse struct {
Count int `json:"count"`
}
type Hit ¶
type Hit struct {
ID string `json:"_id"`
Score float64 `json:"_score"`
Source json.RawMessage `json:"_source"`
}
Hit represents a single search result hit
type OpenSearchClientRetriever ¶
type OpenSearchClientRetriever interface {
Search(ctx context.Context, index string, query []byte, pageSize int) (*SearchResponse, error)
Count(ctx context.Context, index string, query []byte) (*CountResponse, error)
AggregationSearch(ctx context.Context, index string, query []byte) (*AggregationResponse, error)
IsReady(ctx context.Context) error
}
OpenSearchClientRetriever defines the interface for OpenSearch operations This allows for easy mocking and testing
type OpenSearchSearcher ¶
type OpenSearchSearcher struct {
// contains filtered or unexported fields
}
OpenSearchSearcher implements the ResourceSearcher interface for OpenSearch
func (*OpenSearchSearcher) IsReady ¶
func (o *OpenSearchSearcher) IsReady(ctx context.Context) error
func (*OpenSearchSearcher) QueryResources ¶
func (os *OpenSearchSearcher) QueryResources(ctx context.Context, criteria model.SearchCriteria) (*model.SearchResult, error)
QueryResources implements the ResourceSearcher interface
func (*OpenSearchSearcher) QueryResourcesCount ¶ added in v0.4.5
func (os *OpenSearchSearcher) QueryResourcesCount( ctx context.Context, publicCountCriteria model.SearchCriteria, aggregationCriteria model.SearchCriteria, publicOnly bool, ) (*model.CountResult, error)
func (*OpenSearchSearcher) Render ¶
func (os *OpenSearchSearcher) Render(ctx context.Context, criteria model.SearchCriteria) ([]byte, error)
Render generates the OpenSearch query based on the provided search criteria
type SearchResponse ¶
SearchResponse represents the OpenSearch search response
type TermsAggregation ¶ added in v0.4.5
type TermsAggregation struct {
DocCountErrorUpperBound uint64 `json:"doc_count_error_upper_bound"`
SumOtherDocCount uint64 `json:"sum_other_doc_count"`
Buckets []AggregationBucket `json:"buckets"`
}
TermsAggregation represents a terms aggregation response.