v1

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationBucket

type AggregationBucket struct {
	Key          string                         `json:"key"`
	DocCount     uint64                         `json:"doc_count"`
	Aggregations map[string]AggregationResponse `json:"aggregations,omitempty"`
}

type AggregationDateRange

type AggregationDateRange struct {
	From time.Time `json:"from"`
	To   time.Time `json:"to"`
}

type AggregationNumberRange

type AggregationNumberRange struct {
	From float64 `json:"from"`
	To   float64 `json:"to"`
}

type AggregationParams

type AggregationParams struct {
	AggType      string                       `json:"agg_type"`
	Field        string                       `json:"field"`
	WeightField  string                       `json:"weight_field"` // Field name to be used for setting weight for primary field for weighted average aggregation
	Size         int                          `json:"size"`
	Ranges       []AggregationNumberRange     `json:"ranges"`
	DateRanges   []AggregationDateRange       `json:"date_ranges"`
	Aggregations map[string]AggregationParams `json:"aggs"`
}

type AggregationResponse

type AggregationResponse struct {
	Value   interface{}         `json:"value,omitempty"`
	Buckets []AggregationBucket `json:"buckets,omitempty"`
}

type Hit

type Hit struct {
	Index     string                 `json:"_index"`
	Type      string                 `json:"_type"`
	ID        string                 `json:"_id"`
	Score     float64                `json:"_score"`
	Timestamp time.Time              `json:"@timestamp"`
	Source    interface{}            `json:"_source"`
	Highlight map[string]interface{} `json:"highlight,omitempty"`
}

type Hits

type Hits struct {
	Total    Total   `json:"total"`
	MaxScore float64 `json:"max_score"`
	Hits     []Hit   `json:"hits"`
}

type QueryHighlight

type QueryHighlight struct {
	Fields []string `json:"fields"`
	Style  string   `json:"style"`
}

type QueryParams

type QueryParams struct {
	Boost     int        `json:"boost"`
	Term      string     `json:"term"`
	Terms     [][]string `json:"terms"` // For multi phrase query
	Field     string     `json:"field"`
	StartTime time.Time  `json:"start_time"`
	EndTime   time.Time  `json:"end_time"`
}

type SearchResponse

type SearchResponse struct {
	Took         int                            `json:"took"` // Time it took to generate the response
	TimedOut     bool                           `json:"timed_out"`
	Hits         Hits                           `json:"hits"`
	Aggregations map[string]AggregationResponse `json:"aggregations,omitempty"`
	Error        string                         `json:"error,omitempty"`
}

SearchResponse for a query

type Source

type Source struct {
	Enable bool            // enable _source returns, default is true
	Fields map[string]bool // what fields can returns
}

type Total

type Total struct {
	Value int `json:"value"` // Count of documents returned
}

type ZincQuery

type ZincQuery struct {
	// SearchType is the type of search to perform. Can be match, match_phrase, query_string, etc
	SearchType   string                       `json:"search_type"`
	MaxResults   int                          `json:"max_results"`
	From         int                          `json:"from"`
	Explain      bool                         `json:"explain"`
	Highlight    *meta.Highlight              `json:"highlight"`
	Query        QueryParams                  `json:"query"`
	Aggregations map[string]AggregationParams `json:"aggs"`
	SortFields   []string                     `json:"sort_fields"`
	Source       interface{}                  `json:"_source"`
}

ZincQuery is the query object for the zinc index. All search requests should send this struct

type ZincQueryForSDK

type ZincQueryForSDK struct {
	// SearchType is the type of search to perform. Can be match, match_phrase, query_string, etc
	SearchType   string                       `json:"search_type"`
	MaxResults   int                          `json:"max_results"`
	From         int                          `json:"from"`
	Explain      bool                         `json:"explain"`
	Highlight    *meta.Highlight              `json:"highlight"`
	Query        QueryParams                  `json:"query"`
	Aggregations map[string]AggregationParams `json:"aggs"`
	SortFields   []string                     `json:"sort_fields"`
	Source       []string                     `json:"_source"`
}

Jump to

Keyboard shortcuts

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