elasticsearch

package
v0.0.0-...-b7aeced Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(url, namespace string, options ...Option) (*Client, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, ids ...string) error

func (*Client) Index

func (c *Client) Index(ctx context.Context, documents ...index.Document) error

func (*Client) List

func (c *Client) List(ctx context.Context, options *index.ListOptions) (*index.Page[index.Document], error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string, options *index.QueryOptions) ([]index.Result, error)

type Document

type Document struct {
	ID string `json:"id"`

	Title   string `json:"title"`
	Source  string `json:"source"`
	Content string `json:"content"`

	Metadata map[string]string `json:"metadata"`
}

type Option

type Option func(*Client)

func WithClient

func WithClient(client *http.Client) Option

type SearchHit

type SearchHit struct {
	Score    float32  `json:"_score"`
	Document Document `json:"_source"`
}

type SearchHits

type SearchHits struct {
	Hits []SearchHit `json:"hits"`
}

type SearchResult

type SearchResult struct {
	Hits SearchHits `json:"hits"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL