search

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocsIteratorSeq added in v0.77.0

func DocsIteratorSeq(it DocsIterator) iter.Seq2[StreamingDoc, error]

func ReadAll

func ReadAll(i DocsIterator) (dst [][]byte)

ReadAll is currently used only in tests

Types

type AggQuery

type AggQuery struct {
	Field     string
	GroupBy   string
	Func      seq.AggFunc
	Quantiles []float64
	Interval  seq.MID
}

type AsyncRequest

type AsyncRequest struct {
	Retention         time.Duration
	Query             string
	From              time.Time
	To                time.Time
	Aggregations      []AggQuery
	HistogramInterval seq.MID
	WithDocs          bool
	Size              int64
}

type AsyncResponse

type AsyncResponse struct {
	ID string
}

type AsyncSearchesListItem added in v0.59.0

type AsyncSearchesListItem struct {
	ID     string
	Status asyncsearcher.AsyncSearchStatus

	StartedAt  time.Time
	ExpiresAt  time.Time
	CanceledAt time.Time

	Progress  float64
	DiskUsage uint64

	Request AsyncRequest
	Error   error
}

type Config

type Config struct {
	HotStores       *stores.Stores
	HotReadStores   *stores.Stores
	ReadStores      *stores.Stores
	WriteStores     *stores.Stores
	ShuffleReplicas bool
	MirrorAddr      string
}

type DocsIterator

type DocsIterator interface {
	Next() (StreamingDoc, error)
}

type EmptyDocsStream

type EmptyDocsStream struct {
}

func (EmptyDocsStream) Next

func (e EmptyDocsStream) Next() (StreamingDoc, error)

type FetchAsyncSearchResultRequest

type FetchAsyncSearchResultRequest struct {
	ID     string
	Size   int
	Offset int
	Order  seq.DocsOrder
}

type FetchAsyncSearchResultResponse

type FetchAsyncSearchResultResponse struct {
	Status     asyncsearcher.AsyncSearchStatus
	QPR        seq.QPR
	CanceledAt time.Time

	StartedAt time.Time
	ExpiresAt time.Time

	Progress  float64
	DiskUsage uint64

	AggResult []seq.AggregationResult

	Request AsyncRequest
}

type FetchFieldsFilter

type FetchFieldsFilter struct {
	// Fields list of fields to fetch. Empty list means to fetch all fields.
	Fields []string
	// AllowList truth if we need to exclude all fields except the fields from the Fields list
	// and false if we need to exclude given Fields from a fetch result.
	AllowList bool
}

type FetchRequest

type FetchRequest struct {
	IDs          []seq.ID
	FieldsFilter FetchFieldsFilter
}

type GetAsyncSearchesListRequest added in v0.59.0

type GetAsyncSearchesListRequest struct {
	Status *asyncsearcher.AsyncSearchStatus
	Size   int
	Offset int
	IDs    []string
}

type Ingestor

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

func NewIngestor

func NewIngestor(cfg Config, clients map[string]storeapi.StoreApiClient) *Ingestor

func (*Ingestor) CancelAsyncSearch added in v0.59.0

func (si *Ingestor) CancelAsyncSearch(ctx context.Context, id string) error

func (*Ingestor) DeleteAsyncSearch added in v0.59.0

func (si *Ingestor) DeleteAsyncSearch(ctx context.Context, id string) error

func (*Ingestor) Document

func (si *Ingestor) Document(ctx context.Context, id seq.ID, ff FetchFieldsFilter) []byte

func (*Ingestor) Documents

func (si *Ingestor) Documents(ctx context.Context, r FetchRequest) (DocsIterator, error)

func (*Ingestor) FetchDocsStream

func (si *Ingestor) FetchDocsStream(
	ctx context.Context,
	ids []seq.IDSource,
	explain, noSkipMasks bool,
	ff FetchFieldsFilter,
) (DocsIterator, error)

func (*Ingestor) GetAsyncSearchesList added in v0.59.0

func (si *Ingestor) GetAsyncSearchesList(
	ctx context.Context,
	r GetAsyncSearchesListRequest,
) ([]*AsyncSearchesListItem, error)

func (*Ingestor) Search

func (si *Ingestor) Search(
	ctx context.Context,
	sr *SearchRequest,
	tr *querytracer.Tracer,
) (
	qpr *seq.QPR,
	docsStream DocsIterator,
	stats *SearchStats,
	err error,
)

func (*Ingestor) StartAsyncSearch

func (si *Ingestor) StartAsyncSearch(ctx context.Context, r AsyncRequest) (AsyncResponse, error)

func (*Ingestor) Status

func (si *Ingestor) Status(ctx context.Context) *IngestorStatus

type IngestorStatus

type IngestorStatus struct {
	NumberOfStores    int
	OldestStorageTime *time.Time
	Stores            []StoreStatus
}

type SearchRequest

type SearchRequest struct {
	Explain     bool
	Q           []byte
	Offset      int
	OffsetId    string
	Size        int
	Interval    seq.MID
	AggQ        []AggQuery
	From        seq.MID
	To          seq.MID
	WithTotal   bool
	ShouldFetch bool
	Order       seq.DocsOrder
	Downsample  uint32
}

func (*SearchRequest) GetAPISearchRequest

func (sr *SearchRequest) GetAPISearchRequest() *storeapi.SearchRequest

type SearchStats added in v0.77.0

type SearchStats struct {
	Query   string
	Size    int
	HasHist bool
	HasAgg  bool

	StorageTier         StorageTier
	HotSearchDuration   time.Duration
	ColdSearchDuration  time.Duration
	TotalSearchDuration time.Duration

	FetchStart    time.Time
	FetchDuration time.Duration
}

SearchStats carries observability data collected while executing a search.

func (*SearchStats) TakeFetchDuration added in v0.77.0

func (s *SearchStats) TakeFetchDuration()

type StorageTier added in v0.77.0

type StorageTier string

StorageTier shows whether a search was served by hot or cold stores.

const (
	StorageTierHot  StorageTier = "hot"
	StorageTierCold StorageTier = "cold"
	// StorageTierNone is used when a request never reached the ingestor
	// (e.g. it failed validation in the proxy layer).
	StorageTierNone StorageTier = "none"
)

type StoreStatus

type StoreStatus struct {
	Host       string
	OldestTime time.Time
	Error      string
}

type StreamingDoc

type StreamingDoc struct {
	ID     seq.ID
	Data   []byte
	Source uint64
}

func NewStreamingDoc

func NewStreamingDoc(idSource seq.IDSource, data []byte) StreamingDoc

func (*StreamingDoc) Empty

func (d *StreamingDoc) Empty() bool

func (*StreamingDoc) IDSource

func (d *StreamingDoc) IDSource() seq.IDSource

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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