Documentation
¶
Overview ¶
Package elasticsearch provides Elasticsearch search client helpers.
New code should use the core-owned search boundary:
import "github.com/InsideGallery/core/db/elasticsearch"
client, err := elasticsearch.NewSearchClient(elasticsearch.Options{
Addresses: []string{"http://localhost:9200"},
})
Use Searcher, SearchOptions, and SearchResult for consumer-facing code that should not expose Elasticsearch SDK request or response types.
Compatibility: Client and NewClient remain available for existing SDK-shaped callers. Prefer NewSearchClient for new integrations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrWrongResponse = errors.New("wrong response") ErrWrongCountOfArguments = errors.New("error count of arguments") )
Functions ¶
This section is empty.
Types ¶
type Client
deprecated
type Client struct {
*elasticsearch.Client
}
Client is the legacy Elasticsearch SDK-shaped client.
Deprecated: use SearchClient and core-owned option/result types for new code.
func (*Client) GetMatchQuery ¶
type Options ¶ added in v1.1.0
type Options struct {
Addresses []string
Username string
Password string
CloudID string
APIKey string
}
Options is the core-owned input for creating an Elasticsearch search client.
type SearchClient ¶ added in v1.1.0
type SearchClient struct {
// contains filtered or unexported fields
}
SearchClient wraps the Elasticsearch SDK behind core-owned inputs and results.
func NewSearchClient ¶ added in v1.1.0
func NewSearchClient(options Options) (*SearchClient, error)
NewSearchClient creates an Elasticsearch search client from core-owned options.
func (*SearchClient) Search ¶ added in v1.1.0
func (c *SearchClient) Search(ctx context.Context, options SearchOptions) (SearchResult, error)
Search searches indexes through core-owned inputs and results.
type SearchOptions ¶ added in v1.1.0
SearchOptions is the core-owned input for an Elasticsearch search.
type SearchResult ¶ added in v1.1.0
SearchResult is the core-owned search result.
type Searcher ¶ added in v1.1.0
type Searcher interface {
Search(ctx context.Context, options SearchOptions) (SearchResult, error)
}
Searcher is the core-owned Elasticsearch contract for new consumers.