meta

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	IndexTypeStandard = "standard"
	IndexTypeLogs     = "logs"
)
View Source
const (
	VectorIndexHNSW     = "hnsw"      // graphs compare float32 vectors
	VectorIndexInt8HNSW = "int8_hnsw" // graphs compare int8 codes, a quarter of the size
)

Vector index types, as Elasticsearch dense_vector index_options.type.

View Source
const (
	NestedPathField   = "_nested_path"   // keyword: nested property path, only on hidden nested docs
	NestedParentField = "_nested_parent" // keyword: _id of the root document
	JoinNameField     = "_join_name"     // keyword: relation name (parent or child type)
	JoinParentField   = "_join_parent"   // keyword: _id of the parent document
)

Hidden fields used for nested and join documents.

View Source
const (
	TimeFieldName   = "@timestamp"
	IDFieldName     = "@_id"
	ActionFieldName = "@_action"
	ShardFieldName  = "@_shard"
	SourceFieldName = "@_source"
)

Default field name

View Source
const (
	ActionTypeInsert = "insert"
	ActionTypeUpdate = "update"
	ActionTypeDelete = "delete"
)
View Source
const DefaultOtherBucketKey = "_other_"

DefaultOtherBucketKey is the key elasticsearch gives the other bucket of a [filters] aggregation when other_bucket_key is not set.

View Source
const SourceVectorsField = "_source_vectors"

SourceVectorsField is the stored field listing the vectors excluded from a document's _source: a JSON array of their key paths, ["a","b"] for a nested vector and ["a.b"] for a literal key. Joined by dots a path is the name of the stored vector field reads restore it from, so documents written with and without exclusion mix. Documents cannot index a field of this name.

Variables

View Source
var (
	// Version is the version of the program - Git tag - git describe --tags --always
	Version = "v1.0.0"
	// Build is the build number of the program as generated by the CI system
	Build = "0"
	// CommitHash is the commit hash of the program - git rev-parse HEAD
	CommitHash = "0"
	// Branch is the branch of the program
	Branch = "main"
	// Date is the date of the build - date -u '+%Y-%m-%d_%I:%M:%S%p-GMT'
	BuildDate = "0"
)

go build -a -ldflags "-X github.com/vcaesar/zedsearch/pkg/meta.Version=$VERSION" -o zedsearch

View Source
var SEGMENT_CLIENT analytics.Client

Functions

func CheckIndexType

func CheckIndexType(indexType string) error

func ExcludeSourceVectors added in v1.3.0

func ExcludeSourceVectors(source map[string]interface{}, fields []string) (map[string]interface{}, []byte, error)

ExcludeSourceVectors returns source without the values of fields and the SourceVectorsField value listing the ones removed, nil when there is none. Each map on the way is copied once, source is not modified.

func GUI

func GUI(c zhttp.Context)

GUI function gets all events

func GetHealthz

func GetHealthz(c zhttp.Context)

GetHealthz function gets all events

@Id Healthz @Summary Get healthz @Produce json @Success 200 {object} HealthzResponse @Router /healthz [get]

func GetVersion

func GetVersion(c zhttp.Context)

GetVersion returns the version of the program

@Id Version @Summary Get version @Produce json @Success 200 {object} VersionResponse @Router /version [get]

func LookupPath added in v1.3.0

func LookupPath(m map[string]interface{}, path string) (interface{}, bool)

LookupPath returns the value at a dotted path, as keyPath matches it.

func ParseVector

func ParseVector(v interface{}, dims int) ([]float32, error)

ParseVector accepts a vector field value as a numeric array and checks it against dims when dims > 0. All values must be finite.

func ParseVectorMetric

func ParseVectorMetric(name string) (riot.Metric, error)

ParseVectorMetric resolves an Elasticsearch similarity or OpenSearch space_type name to a riot metric.

func RestoreSourceVectors added in v1.3.0

func RestoreSourceVectors(source []byte, stored map[string][]byte) ([]byte, error)

RestoreSourceVectors returns source with the vectors excluded from it, given the stored fields of its document by name.

Types

type AggregationAutoDateHistogram

type AggregationAutoDateHistogram struct {
	Field           string `json:"field"`
	Buckets         int    `json:"buckets"`
	MinimumInterval string `json:"minimum_interval"` // minute,hour,day,week,month,quarter,year
	Format          string `json:"format"`           // format key_as_string
	TimeZone        string `json:"time_zone"`        // time_zone
	Keyed           bool   `json:"keyed"`
}

type AggregationBucketScript

type AggregationBucketScript struct {
	BucketsPath map[string]string `json:"buckets_path"`
	Script      interface{}       `json:"script"`
	GapPolicy   string            `json:"gap_policy,omitempty"`
	Format      string            `json:"format,omitempty"`
}

AggregationBucketScript is shared by bucket_script and bucket_selector. {"bucket_script": {"buckets_path": {"t": "total", "c": "count"}, "script": "params.t / params.c"}} script accepts either a string or {"source": "..."}.

type AggregationBucketSort

type AggregationBucketSort struct {
	Sort      []map[string]interface{} `json:"sort"`
	From      int                      `json:"from"`
	Size      int                      `json:"size"`
	GapPolicy string                   `json:"gap_policy,omitempty"`
}

AggregationBucketSort {"bucket_sort": {"sort": [{"total_sales": {"order": "desc"}}], "size": 3, "from": 0}}

type AggregationDateHistogram

type AggregationDateHistogram struct {
	Field            string                      `json:"field"`
	Size             int                         `json:"size"`
	Interval         string                      `json:"interval"`          // ms,s,m,h,d
	FixedInterval    string                      `json:"fixed_interval"`    // ms,s,m,h,d
	CalendarInterval string                      `json:"calendar_interval"` // minute,hour,day,week,month,quarter,year
	Format           string                      `json:"format"`            // format key_as_string
	TimeZone         string                      `json:"time_zone"`         // time_zone
	MinDocCount      int                         `json:"min_doc_count"`
	Keyed            bool                        `json:"keyed"`
	ExtendedBounds   *aggregation.HistogramBound `json:"extended_bounds"`
	HardBounds       *aggregation.HistogramBound `json:"hard_bounds"`
}

type AggregationDateRange

type AggregationDateRange struct {
	Field    string      `json:"field"`
	Format   string      `json:"format"`    // format the `to` and `from` values to `_as_string`, and used to format `keyed response`
	TimeZone string      `json:"time_zone"` // refer
	Ranges   []DateRange `json:"ranges"`    // refer
	Keyed    bool        `json:"keyed"`
}

AggregationDateRange struct DateFormat/Pattern refer to: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern

type AggregationExtendedStats

type AggregationExtendedStats struct {
	Field string  `json:"field"`
	Sigma float64 `json:"sigma"` // std_deviation_bounds multiplier, default 2
}

type AggregationFilters

type AggregationFilters struct {
	Filters        map[string]interface{} `json:"filters"`
	OtherBucket    bool                   `json:"other_bucket,omitempty"`
	OtherBucketKey string                 `json:"other_bucket_key,omitempty"`
}

AggregationFilters {"filters": {"filters": {"errors": {"match": {...}}, "warnings": {...}}, "other_bucket_key": "other"}} other_bucket adds a bucket for the documents matching no filter; setting other_bucket_key implies it, as in elasticsearch.

type AggregationHistogram

type AggregationHistogram struct {
	Field          string                      `json:"field"`
	Size           int                         `json:"size"`
	Interval       float64                     `json:"interval"`
	Offset         float64                     `json:"offset"`
	MinDocCount    int                         `json:"min_doc_count"`
	Keyed          bool                        `json:"keyed"`
	ExtendedBounds *aggregation.HistogramBound `json:"extended_bounds"`
	HardBounds     *aggregation.HistogramBound `json:"hard_bounds"`
}

type AggregationHit

type AggregationHit struct {
	Index  string      `json:"_index,omitempty"`
	Type   string      `json:"_type,omitempty"`
	ID     string      `json:"_id"`
	Score  float64     `json:"_score"`
	Source interface{} `json:"_source,omitempty"`
}

AggregationHit is one document returned by top_hits.

type AggregationHits

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

AggregationHits is the top_hits aggregation payload.

type AggregationIPRange

type AggregationIPRange struct {
	Field  string    `json:"field"`
	Ranges []IPRange `json:"ranges"`
	Keyed  bool      `json:"keyed"`
}

type AggregationMetric

type AggregationMetric struct {
	Field       string `json:"field"`
	WeightField string `json:"weight_field"` // Field name to be used for setting weight for primary field for weighted average aggregation
}

type AggregationMovingFn

type AggregationMovingFn struct {
	AggregationPipeline
	Window int    `json:"window"`
	Script string `json:"script"`
	Shift  int    `json:"shift,omitempty"`
}

AggregationMovingFn {"moving_fn": {"buckets_path": "the_sum", "window": 10, "script": "MovingFunctions.unweightedAvg(values)", "shift": 0}}

type AggregationMultiTerms

type AggregationMultiTerms struct {
	Terms []AggregationMetric `json:"terms"`
	Size  int                 `json:"size"`
	Order map[string]string   `json:"order"`
}

AggregationMultiTerms {"multi_terms": {"terms": [{"field": "a"}, {"field": "b"}], "size": 10}}

type AggregationNested

type AggregationNested struct {
	Path string `json:"path"`
}

AggregationNested {"nested": {"path": "comments"}} / {"reverse_nested": {}}

type AggregationPercentileRanks

type AggregationPercentileRanks struct {
	Field  string    `json:"field"`
	Values []float64 `json:"values"`
	Keyed  bool      `json:"keyed"`
}

AggregationPercentileRanks {"percentile_ranks": {"field": "load", "values": [500, 600]}}

type AggregationPercentiles

type AggregationPercentiles struct {
	Field    string    `json:"field"`
	Percents []float64 `json:"percents"` // default [1, 5, 25, 50, 75, 95, 99]
	Keyed    bool      `json:"keyed"`
}

type AggregationPipeline

type AggregationPipeline struct {
	BucketsPath string `json:"buckets_path"`
	GapPolicy   string `json:"gap_policy,omitempty"` // skip (default), insert_zeros, keep_values
	Format      string `json:"format,omitempty"`
}

AggregationPipeline is the common shape of sibling/parent pipeline aggregations. {"avg_bucket": {"buckets_path": "sales_per_month>sales", "gap_policy": "skip", "format": "..."}}

type AggregationRange

type AggregationRange struct {
	Field  string  `json:"field"`
	Ranges []Range `json:"ranges"`
	Keyed  bool    `json:"keyed"`
}

type AggregationResponse

type AggregationResponse struct {
	Value    interface{} `json:"value,omitempty"`
	Buckets  interface{} `json:"buckets,omitempty"`  // slice or map
	Interval string      `json:"interval,omitempty"` // support for auto_date_histogram_aggregation

	// stats aggregation; pointers so that a zero count / min still serializes
	Count *uint64  `json:"count,omitempty"`
	Min   *float64 `json:"min,omitempty"`
	Max   *float64 `json:"max,omitempty"`
	Avg   *float64 `json:"avg,omitempty"`
	Sum   *float64 `json:"sum,omitempty"`

	// extended_stats aggregation, in addition to the stats fields above
	SumOfSquares       *float64                       `json:"sum_of_squares,omitempty"`
	Variance           *float64                       `json:"variance,omitempty"`
	StdDeviation       *float64                       `json:"std_deviation,omitempty"`
	StdDeviationBounds *AggregationStdDeviationBounds `json:"std_deviation_bounds,omitempty"`

	// percentiles aggregation, keyed form only: {"1.0": v, ...}.
	// Elasticsearch returns an array of {key, value} objects when keyed is
	// false, zed always returns the keyed map.
	Values map[string]float64 `json:"values,omitempty"`

	// missing / filter / filters / nested aggregations
	DocCount *uint64 `json:"doc_count,omitempty"`

	// top_hits aggregation
	Hits *AggregationHits `json:"hits,omitempty"`

	// Aggregations holds the sub-aggregations of a single bucket (filter,
	// filters entry, nested). Elasticsearch renders them as siblings of
	// doc_count, so MarshalJSON splices them into the same object.
	Aggregations map[string]AggregationResponse `json:"-"`
}

func (AggregationResponse) MarshalJSON

func (a AggregationResponse) MarshalJSON() ([]byte, error)

MarshalJSON renders the sub-aggregations of a single bucket inline, next to the fields of the aggregation itself.

type AggregationSerialDiff

type AggregationSerialDiff struct {
	AggregationPipeline
	Lag int `json:"lag"`
}

AggregationSerialDiff {"serial_diff": {"buckets_path": "the_sum", "lag": 7}}

type AggregationStdDeviationBounds

type AggregationStdDeviationBounds struct {
	Upper float64 `json:"upper"`
	Lower float64 `json:"lower"`
}

type AggregationTopHits

type AggregationTopHits struct {
	Size   int         `json:"size"`
	From   int         `json:"from"`
	Sort   interface{} `json:"sort"`
	Source interface{} `json:"_source"`
}

AggregationTopHits {"top_hits": {"size": 3, "sort": [...], "_source": [...]}}

type Aggregations

type Aggregations struct {
	Avg               *AggregationMetric            `json:"avg"`
	WeightedAvg       *AggregationMetric            `json:"weighted_avg"`
	Max               *AggregationMetric            `json:"max"`
	Min               *AggregationMetric            `json:"min"`
	Sum               *AggregationMetric            `json:"sum"`
	Count             *AggregationMetric            `json:"count"`
	ValueCount        *AggregationMetric            `json:"value_count"`
	Stats             *AggregationMetric            `json:"stats"`
	ExtendedStats     *AggregationExtendedStats     `json:"extended_stats"`
	Percentiles       *AggregationPercentiles       `json:"percentiles"`
	Missing           *AggregationMetric            `json:"missing"`
	Cardinality       *AggregationMetric            `json:"cardinality"`
	Terms             *AggregationsTerms            `json:"terms"`
	Range             *AggregationRange             `json:"range"`
	DateRange         *AggregationDateRange         `json:"date_range"`
	Histogram         *AggregationHistogram         `json:"histogram"`
	DateHistogram     *AggregationDateHistogram     `json:"date_histogram"`
	AutoDateHistogram *AggregationAutoDateHistogram `json:"auto_date_histogram"`
	IPRange           *AggregationIPRange           `json:"ip_range"` // TODO: not implemented
	// bucket aggregations
	Filter          interface{}                 `json:"filter"`  // {query}
	Filters         *AggregationFilters         `json:"filters"` // {"filters": {"name": {query}}}
	Global          *struct{}                   `json:"global"`
	MultiTerms      *AggregationMultiTerms      `json:"multi_terms"`
	TopHits         *AggregationTopHits         `json:"top_hits"`
	PercentileRanks *AggregationPercentileRanks `json:"percentile_ranks"`
	Nested          *AggregationNested          `json:"nested"`
	ReverseNested   *AggregationNested          `json:"reverse_nested"`
	// pipeline aggregations (evaluated on the response tree after bucket aggregations)
	AvgBucket      *AggregationPipeline     `json:"avg_bucket"`
	SumBucket      *AggregationPipeline     `json:"sum_bucket"`
	MinBucket      *AggregationPipeline     `json:"min_bucket"`
	MaxBucket      *AggregationPipeline     `json:"max_bucket"`
	StatsBucket    *AggregationPipeline     `json:"stats_bucket"`
	CumulativeSum  *AggregationPipeline     `json:"cumulative_sum"`
	Derivative     *AggregationPipeline     `json:"derivative"`
	SerialDiff     *AggregationSerialDiff   `json:"serial_diff"`
	MovingFn       *AggregationMovingFn     `json:"moving_fn"`
	BucketScript   *AggregationBucketScript `json:"bucket_script"`
	BucketSelector *AggregationBucketScript `json:"bucket_selector"`
	BucketSort     *AggregationBucketSort   `json:"bucket_sort"`
	Aggregations   map[string]Aggregations  `json:"aggs"` // nested aggregations
}

type AggregationsTerms

type AggregationsTerms struct {
	Field string            `json:"field"`
	Size  int               `json:"size"`
	Order map[string]string `json:"order"` // { "_count": "asc" }
}

type Analyzer

type Analyzer struct {
	CharFilter  []string `json:"char_filter,omitempty"`
	Tokenizer   string   `json:"tokenizer,omitempty"`
	TokenFilter []string `json:"token_filter,omitempty"`
	Filter      []string `json:"filter,omitempty"` // compatibility with es, alias for TokenFilter

	// options for compatible
	Type      string   `json:"type,omitempty"`
	Pattern   string   `json:"pattern,omitempty"`   // for type=pattern
	Lowercase bool     `json:"lowercase,omitempty"` // for type=pattern
	Stopwords []string `json:"stopwords,omitempty"` // for type=pattern,standard,stop
}

type BoolQuery

type BoolQuery struct {
	Should             interface{} `json:"should,omitempty"`               // query, [query1, query2]
	Must               interface{} `json:"must,omitempty"`                 // query, [query1, query2]
	MustNot            interface{} `json:"must_not,omitempty"`             // query, [query1, query2]
	Filter             interface{} `json:"filter,omitempty"`               // query, [query1, query2]
	MinimumShouldMatch interface{} `json:"minimum_should_match,omitempty"` // only for should
}

type BoolQueryForSDK

type BoolQueryForSDK struct {
	Should             []*QueryForSDK `json:"should,omitempty"`               // query, [query1, query2]
	Must               []*QueryForSDK `json:"must,omitempty"`                 // query, [query1, query2]
	MustNot            []*QueryForSDK `json:"must_not,omitempty"`             // query, [query1, query2]
	Filter             []*QueryForSDK `json:"filter,omitempty"`               // query, [query1, query2]
	MinimumShouldMatch float64        `json:"minimum_should_match,omitempty"` // only for should
}

type BoostingQuery

type BoostingQuery struct {
	Positive      interface{} `json:"positive,omitempty"` // singe or multiple queries
	Negative      interface{} `json:"negative,omitempty"` // singe or multiple queries
	NegativeBoost float64     `json:"negative_boost,omitempty"`
}

type CombinedFieldsQuery

type CombinedFieldsQuery struct {
	Query              string   `json:"query,omitempty"`
	Analyzer           string   `json:"analyzer,omitempty"`
	Fields             []string `json:"fields,omitempty"`
	Operator           string   `json:"operator,omitempty"` // or(default), and
	MinimumShouldMatch float64  `json:"minimum_should_match,omitempty"`
}

type ConstantScoreQuery

type ConstantScoreQuery struct {
	Filter interface{} `json:"filter"`
	Boost  float64     `json:"boost,omitempty"`
}

ConstantScoreQuery {"constant_score": {"filter": {query}, "boost": 1.2}}

type DateRange

type DateRange struct {
	To   string `json:"to"`
	From string `json:"from"`
}

type DisMaxQuery

type DisMaxQuery struct {
	Queries    []interface{} `json:"queries"`
	TieBreaker float64       `json:"tie_breaker,omitempty"`
}

DisMaxQuery {"dis_max": {"queries": [query1, query2], "tie_breaker": 0.7}}

type ExistsQuery

type ExistsQuery struct {
	Field string `json:"field,omitempty"`
}

ExistsQuery {"exists":{"field":"field_name"}}

type Field

type Field struct {
	Field  string `json:"field"`
	Format string `json:"format"`
}

type FunctionScoreQuery

type FunctionScoreQuery struct {
	Query            interface{}              `json:"query,omitempty"`
	Functions        []map[string]interface{} `json:"functions,omitempty"`
	BoostMode        string                   `json:"boost_mode,omitempty"` // multiply, replace, sum, avg, max, min
	ScoreMode        string                   `json:"score_mode,omitempty"` // multiply, sum, avg, first, max, min
	MaxBoost         float64                  `json:"max_boost,omitempty"`
	MinScore         float64                  `json:"min_score,omitempty"`
	Boost            float64                  `json:"boost,omitempty"`
	Weight           *float64                 `json:"weight,omitempty"`
	FieldValueFactor map[string]interface{}   `json:"field_value_factor,omitempty"`
	RandomScore      map[string]interface{}   `json:"random_score,omitempty"`
	Gauss            map[string]interface{}   `json:"gauss,omitempty"`
	Exp              map[string]interface{}   `json:"exp,omitempty"`
	Linear           map[string]interface{}   `json:"linear,omitempty"`
}

FunctionScoreQuery {"function_score": {"query": {query}, "functions": [...], "boost_mode": "multiply", "score_mode": "multiply", "max_boost": 10, "min_score": 0}} A single function may also be given inline (weight, field_value_factor, random_score, gauss/exp/linear).

type FuzzyQuery

type FuzzyQuery struct {
	Value        string      `json:"value,omitempty"`
	Fuzziness    interface{} `json:"fuzziness,omitempty"` // auto, 1,2,3,n
	PrefixLength float64     `json:"prefix_length,omitempty"`
	Boost        float64     `json:"boost,omitempty"`
}

FuzzyQuery {"fuzzy":{"field":"value"}} {"fuzzy":{"field":{"value":"value","fuzziness":"auto"}}}

type GeoPoint

type GeoPoint struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

GeoPoint is the canonical value of a geo_point field.

func ParseGeoPoint

func ParseGeoPoint(v interface{}) (GeoPoint, error)

ParseGeoPoint accepts the Elasticsearch geo_point formats:

{"lat": 41.12, "lon": -71.34}
{"type": "Point", "coordinates": [-71.34, 41.12]}
[-71.34, 41.12]
"41.12,-71.34"
"POINT (-71.34 41.12)"
"drm3btev3e86" (geohash)

type HTTPResponse

type HTTPResponse struct {
	Message string `json:"message"`
}

type HTTPResponseDeleteByQuery

type HTTPResponseDeleteByQuery struct {
	Took                 int64               `json:"took"`
	TimedOut             bool                `json:"time_out"`
	Total                int                 `json:"total"`
	Deleted              int                 `json:"deleted"`
	Batches              int                 `json:"batches"`
	VersionConflicts     int                 `json:"version_conflicts"`
	Noops                int                 `json:"noops"`
	Failures             []string            `json:"failures"`
	Retries              HttpRetriesResponse `json:"retries"`
	ThrottledMillis      int                 `json:"throttled_millis"`
	RequestsPerSecond    int                 `json:"requests_per_second"`
	ThrottledUntilMillis int                 `json:"throttled_until_millis"`
}

type HTTPResponseDocument

type HTTPResponseDocument struct {
	Message string `json:"message"`
	Index   string `json:"index"`
	ID      string `json:"id,omitempty"`
}

type HTTPResponseESID

type HTTPResponseESID struct {
	Message     string `json:"message"`
	ID          string `json:"id"`
	ESID        string `json:"_id"`
	Index       string `json:"_index"`
	Version     int    `json:"_version"`
	SeqNo       int    `json:"_seq_no"`
	PrimaryTerm int    `json:"_primary_term"`
	Result      string `json:"result"` // created, updated, deleted
}

type HTTPResponseError

type HTTPResponseError struct {
	Error string `json:"error"`
}

type HTTPResponseID

type HTTPResponseID struct {
	Message string `json:"message"`
	ID      string `json:"id"`
}

type HTTPResponseIndex

type HTTPResponseIndex struct {
	Message     string `json:"message"`
	Index       string `json:"index"`
	StorageType string `json:"storage_type,omitempty"`
}

type HTTPResponseRecordCount

type HTTPResponseRecordCount struct {
	Message     string `json:"message"`
	RecordCount int64  `json:"record_count"`
}

type HTTPResponseTemplate

type HTTPResponseTemplate struct {
	Message  string `json:"message"`
	Template string `json:"template"`
}

type HasChildQuery

type HasChildQuery struct {
	Type        string      `json:"type"`
	Query       interface{} `json:"query"`
	ScoreMode   string      `json:"score_mode,omitempty"`
	MinChildren int         `json:"min_children,omitempty"`
	MaxChildren int         `json:"max_children,omitempty"`
}

HasChildQuery {"has_child": {"type": "answer", "query": {query}, "score_mode": "none", "min_children": 1}}

type HasParentQuery

type HasParentQuery struct {
	ParentType string      `json:"parent_type"`
	Query      interface{} `json:"query"`
	Score      bool        `json:"score,omitempty"`
}

HasParentQuery {"has_parent": {"parent_type": "question", "query": {query}, "score": false}}

type HealthzResponse

type HealthzResponse struct {
	Status string `json:"status"`
}

type Highlight

type Highlight struct {
	NumberOfFragments int                   `json:"number_of_fragments"`
	FragmentSize      int                   `json:"fragment_size"`
	PreTags           []string              `json:"pre_tags"`
	PostTags          []string              `json:"post_tags"`
	Fields            map[string]*Highlight `json:"fields"`
}

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,omitempty"`
	Fields    map[string]interface{} `json:"fields,omitempty"`
	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 HttpRetriesResponse

type HttpRetriesResponse struct {
	Bulk   int `json:"bulk"`
	Search int `json:"search"`
}

type IPRange

type IPRange struct {
	To   string `json:"to"`
	From string `json:"from"`
}

type IdsQuery

type IdsQuery struct {
	Values []string `json:"values,omitempty"`
}

IdsQuery {"ids":{"values":["1","2","3"]}}

type Index

type Index struct {
	ShardNum    int64                  `json:"shard_num"`
	Name        string                 `json:"name"`
	StorageType string                 `json:"storage_type"`
	Settings    *IndexSettings         `json:"settings,omitempty"`
	Mappings    *Mappings              `json:"mappings,omitempty"`
	Shards      map[string]*IndexShard `json:"shards"`
	Stats       IndexStat              `json:"stats"`
	Version     string                 `json:"version"`
}

type IndexAnalysis

type IndexAnalysis struct {
	Analyzer    map[string]*Analyzer   `json:"analyzer,omitempty"`
	CharFilter  map[string]interface{} `json:"char_filter,omitempty"`
	Tokenizer   map[string]interface{} `json:"tokenizer,omitempty"`
	TokenFilter map[string]interface{} `json:"token_filter,omitempty"`
	Filter      map[string]interface{} `json:"filter,omitempty"` // compatibility with es, alias for TokenFilter
}

type IndexLifecycle

type IndexLifecycle struct {
	Policy    string `json:"policy,omitempty"`
	WarmAfter string `json:"warm_after,omitempty"`
	ColdAfter string `json:"cold_after,omitempty"`
	// DeleteAfter removes the index entirely; empty keeps it forever.
	DeleteAfter string `json:"delete_after,omitempty"`
}

IndexLifecycle mirrors a minimal ILM policy: move the index to the next tier once its newest document is older than the given duration ("7d", "30d").

type IndexSecondShard

type IndexSecondShard struct {
	ID    int64     `json:"id"`
	Stats IndexStat `json:"stats"`
}

type IndexSettings

type IndexSettings struct {
	// IndexType selects the document profile; empty preserves standard indexes.
	IndexType        string         `json:"index_type,omitempty"`
	NumberOfShards   int64          `json:"number_of_shards,omitempty"`
	NumberOfReplicas int64          `json:"number_of_replicas,omitempty"`
	Analysis         *IndexAnalysis `json:"analysis,omitempty"`
	// Tier is the current data tier: hot (local disk, writable), warm
	// (object storage, writable) or cold (object storage, read-only,
	// shared by every node). Empty means hot.
	Tier string `json:"tier,omitempty"`
	// Lifecycle drives automatic tier transitions by index age.
	Lifecycle *IndexLifecycle `json:"lifecycle,omitempty"`
	// ExcludeSourceVectors keeps vector fields out of the stored _source and
	// restores them from the stored vectors on read; nil takes
	// zed_exclude_source_vectors. Set at creation only.
	ExcludeSourceVectors *bool `json:"exclude_source_vectors,omitempty"`
}

func (*IndexSettings) UnmarshalJSON added in v1.3.0

func (s *IndexSettings) UnmarshalJSON(data []byte) error

UnmarshalJSON also reads ExcludeSourceVectors from its Elasticsearch and OpenSearch setting names.

type IndexShard

type IndexShard struct {
	ShardNum int64               `json:"shard_num"`
	ID       string              `json:"id"`
	NodeID   string              `json:"node_id"` // remote instance ID
	Shards   []*IndexSecondShard `json:"shards"`
	Stats    IndexStat           `json:"stats"`
}

type IndexShardV026

type IndexShardV026 struct {
	ID          int64        `json:"id"`
	DocTimeMin  int64        `json:"doc_time_min"`
	DocTimeMax  int64        `json:"doc_time_max"`
	DocNum      uint64       `json:"doc_num"`
	StorageSize uint64       `json:"storage_size"`
	Writer      *riot.Writer `json:"-"`
	Lock        sync.RWMutex `json:"-"`
}

type IndexSimple

type IndexSimple struct {
	Name        string                 `json:"name"`
	StorageType string                 `json:"storage_type"`
	ShardNum    int64                  `json:"shard_num"`
	Settings    *IndexSettings         `json:"settings,omitempty"`
	Mappings    map[string]interface{} `json:"mappings,omitempty"`
}

type IndexStat

type IndexStat struct {
	DocTimeMin  int64  `json:"doc_time_min"`
	DocTimeMax  int64  `json:"doc_time_max"`
	DocNum      uint64 `json:"doc_num"`
	StorageSize uint64 `json:"storage_size"`
	WALSize     uint64 `json:"wal_size"`
}

type IndexTemplate

type IndexTemplate struct {
	IndexPatterns []string         `json:"index_patterns"`
	Priority      int              `json:"priority"` // highest priority is chosen
	Template      TemplateTemplate `json:"template"`
	CreatedAt     time.Time        `json:"created_at"`
	UpdatedAt     time.Time        `json:"updated_at"`
}

type IndexV026

type IndexV026 struct {
	Name        string            `json:"name"`
	StorageType string            `json:"storage_type"`
	StorageSize uint64            `json:"storage_size"`
	DocNum      uint64            `json:"doc_num"`
	DocTimeMin  int64             `json:"doc_time_min"`
	DocTimeMax  int64             `json:"doc_time_max"`
	ShardNum    int64             `json:"shard_num"`
	Shards      []*IndexShardV026 `json:"shards"`
	WAL         *wal.Log          `json:"-"`
	WALSize     uint64            `json:"wal_size"`
	Settings    *IndexSettings    `json:"settings,omitempty"`
	Mappings    *Mappings         `json:"mappings,omitempty"`
	CreateAt    time.Time         `json:"create_at"`
	UpdateAt    time.Time         `json:"update_at"`
}

IndexV026 compatible for v0.2.6 index

type JSONIngest

type JSONIngest struct {
	Index   string                   `json:"index"`
	Records []map[string]interface{} `json:"records"`
}

type Mappings

type Mappings struct {
	Properties map[string]Property `json:"properties,omitempty"`
	// Source is the Elasticsearch `_source` mapping; nil stores _source.
	Source *SourceMapping `json:"_source,omitempty"`
	// All is the `_all` mapping; nil follows zed_all_field.
	All *SourceMapping `json:"_all,omitempty"`
	// contains filtered or unexported fields
}

func NewMappings

func NewMappings() *Mappings

func (*Mappings) AddVectorFields added in v1.3.0

func (t *Mappings) AddVectorFields(fields ...string)

AddVectorFields adds vector fields VectorFields returns without mapping them: a search over several indexes restores the vectors of every index, while its query keeps the property one index defines for the name.

func (*Mappings) AllEnabled added in v1.3.0

func (t *Mappings) AllEnabled() bool

AllEnabled reports whether documents index the _all field.

func (*Mappings) DeepClone

func (t *Mappings) DeepClone() *Mappings

DeepClone returns a full copy of the mapping.

func (*Mappings) GetProperty

func (t *Mappings) GetProperty(field string) (Property, bool)

func (*Mappings) Len

func (t *Mappings) Len() int

func (*Mappings) ListProperty

func (t *Mappings) ListProperty() map[string]Property

func (*Mappings) MarshalJSON

func (t *Mappings) MarshalJSON() ([]byte, error)

func (*Mappings) RangeProperty

func (t *Mappings) RangeProperty(fn func(field string, prop Property) bool)

RangeProperty calls fn for each property until fn returns false. Unlike ListProperty it does not copy the map; fn runs under the read lock and must not modify t.

func (*Mappings) SetAllEnabled added in v1.3.0

func (t *Mappings) SetAllEnabled(enabled bool)

SetAllEnabled sets the _all mapping.

func (*Mappings) SetProperty

func (t *Mappings) SetProperty(field string, prop Property)

func (*Mappings) SetSourceEnabled added in v1.3.0

func (t *Mappings) SetSourceEnabled(enabled bool)

SetSourceEnabled sets the _source mapping.

func (*Mappings) SourceEnabled added in v1.3.0

func (t *Mappings) SourceEnabled() bool

SourceEnabled reports whether documents keep their _source.

func (*Mappings) VectorFields added in v1.3.0

func (t *Mappings) VectorFields() []string

VectorFields returns the indexed vector fields, whose values are stored, and the fields added by AddVectorFields.

type MatchAllQuery

type MatchAllQuery struct{}

type MatchBoolPrefixQuery

type MatchBoolPrefixQuery struct {
	Query    string  `json:"query,omitempty"`
	Analyzer string  `json:"analyzer,omitempty"`
	Boost    float64 `json:"boost,omitempty"`
}

type MatchNoneQuery

type MatchNoneQuery struct{}

type MatchPhrasePrefixQuery

type MatchPhrasePrefixQuery struct {
	Query    string  `json:"query,omitempty"`
	Analyzer string  `json:"analyzer,omitempty"`
	Boost    float64 `json:"boost,omitempty"`
}

type MatchPhraseQuery

type MatchPhraseQuery struct {
	Query    string  `json:"query,omitempty"`
	Analyzer string  `json:"analyzer,omitempty"`
	Boost    float64 `json:"boost,omitempty"`
}

type MatchQuery

type MatchQuery struct {
	Query        string      `json:"query,omitempty"`
	Analyzer     string      `json:"analyzer,omitempty"`
	Operator     string      `json:"operator,omitempty"`  // or(default), and
	Fuzziness    interface{} `json:"fuzziness,omitempty"` // auto, 1,2,3,n
	PrefixLength float64     `json:"prefix_length,omitempty"`
	Boost        float64     `json:"boost,omitempty"`
}

type MultiMatchQuery

type MultiMatchQuery struct {
	Query              string      `json:"query,omitempty"`
	Analyzer           string      `json:"analyzer,omitempty"`
	Fields             []string    `json:"fields,omitempty"`
	Boost              float64     `json:"boost,omitempty"`
	Type               string      `json:"type,omitempty"`     // best_fields(default), most_fields, cross_fields, phrase, phrase_prefix, bool_prefix
	Operator           string      `json:"operator,omitempty"` // or(default), and
	MinimumShouldMatch interface{} `json:"minimum_should_match,omitempty"`
}

type NestedQuery

type NestedQuery struct {
	Path      string      `json:"path"`
	Query     interface{} `json:"query"`
	ScoreMode string      `json:"score_mode,omitempty"` // avg, sum, min, max, none
}

NestedQuery {"nested": {"path": "comments", "query": {query}, "score_mode": "avg"}}

type Page

type Page struct {
	PageNum  int64 `json:"page_num"`
	PageSize int64 `json:"page_size"`
	Total    int64 `json:"total"`
}

func NewPage

func NewPage(c zhttp.Context) *Page

func (*Page) GetStartEndIndex

func (e *Page) GetStartEndIndex() (startIndex, endIndex int64)

type ParentIDQuery

type ParentIDQuery struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

ParentIDQuery {"parent_id": {"type": "answer", "id": "1"}}

type PrefixQuery

type PrefixQuery struct {
	Value string  `json:"value,omitempty"` // You can speed up prefix queries using the index_prefixes mapping parameter.
	Boost float64 `json:"boost,omitempty"`
}

PrefixQuery {"prefix":{"field":"value"}} {"prefix":{"field":{"value":"value","boost":1.0}}}

type Property

type Property struct {
	Type           string `json:"type"` // text, keyword, date, numeric, boolean, geo_point, vector, nested, join
	Analyzer       string `json:"analyzer,omitempty"`
	SearchAnalyzer string `json:"search_analyzer,omitempty"`
	Format         string `json:"format,omitempty"`    // date format yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || epoch_millis
	TimeZone       string `json:"time_zone,omitempty"` // date format time_zone
	Dims           int    `json:"dims,omitempty"`      // vector dimension, 0 accepts any
	Index          bool   `json:"index"`
	Store          bool   `json:"store"`
	Sortable       bool   `json:"sortable"`
	Aggregatable   bool   `json:"aggregatable"`
	Highlightable  bool   `json:"highlightable"`
	// Fields allow the same string value to be indexed in multiple ways for different purposes,
	// such as one field for search and a multi-field for sorting and aggregations,
	// or the same string value analyzed by different analyzers.
	// If the Fields property is defined within a sub-field, it will be ignored.
	//
	// Currently, only "text" fields support the Fields parameter.
	Fields map[string]Property `json:"fields,omitempty"`
	// Properties holds the sub-fields of a "nested" property. Each element of
	// the nested array is indexed as its own hidden document tagged with
	// NestedPathField / NestedParentField so nested queries and aggregations
	// keep per-object semantics.
	Properties map[string]Property `json:"properties,omitempty"`
	// Relations defines parent -> children for a "join" property, e.g.
	// {"question": ["answer", "comment"]}. Documents set the field to
	// {"name": "answer", "parent": "<parent _id>"} or just "question".
	Relations map[string][]string `json:"relations,omitempty"`
	// IndexOptions enables HNSW approximate search on a vector field by default.
	IndexOptions *VectorIndexOptions `json:"index_options,omitempty"`
	// Similarity is the default knn metric of a vector field, cosine when empty.
	Similarity riot.Metric `json:"similarity,omitempty" swaggertype:"string"`
}

func NewProperty

func NewProperty(typ string) Property

func (*Property) AddField

func (p *Property) AddField(field string, value Property)

AddField adds the given field to the property.

func (*Property) DeepClone

func (p *Property) DeepClone() Property

DeepClone returns a copy of the Property.

type Query

type Query struct {
	Bool              *BoolQuery                         `json:"bool,omitempty"`                // .
	Boosting          *BoostingQuery                     `json:"boosting,omitempty"`            // TODO: not implemented
	Match             map[string]*MatchQuery             `json:"match,omitempty"`               // simple, MatchQuery
	MatchBoolPrefix   map[string]*MatchBoolPrefixQuery   `json:"match_bool_prefix,omitempty"`   // simple, MatchBoolPrefixQuery
	MatchPhrase       map[string]*MatchPhraseQuery       `json:"match_phrase,omitempty"`        // simple, MatchPhraseQuery
	MatchPhrasePrefix map[string]*MatchPhrasePrefixQuery `json:"match_phrase_prefix,omitempty"` // simple, MatchPhrasePrefixQuery
	MultiMatch        *MultiMatchQuery                   `json:"multi_match,omitempty"`         // .
	MatchAll          *MatchAllQuery                     `json:"match_all,omitempty"`           // just set or null
	MatchNone         *MatchNoneQuery                    `json:"match_none,omitempty"`          // just set or null
	CombinedFields    *CombinedFieldsQuery               `json:"combined_fields,omitempty"`     // TODO: not implemented
	QueryString       *QueryStringQuery                  `json:"query_string,omitempty"`        // .
	SimpleQueryString *SimpleQueryStringQuery            `json:"simple_query_string,omitempty"` // .
	Exists            *ExistsQuery                       `json:"exists,omitempty"`              // .
	Ids               *IdsQuery                          `json:"ids,omitempty"`                 // .
	Range             map[string]*RangeQuery             `json:"range,omitempty"`               // simple, FuzzyQuery
	Regexp            map[string]*RegexpQuery            `json:"regexp,omitempty"`              // simple, FuzzyQuery
	Prefix            map[string]*PrefixQuery            `json:"prefix,omitempty"`              // .
	Fuzzy             map[string]*FuzzyQuery             `json:"fuzzy,omitempty"`               // simple, PrefixQuery
	Wildcard          map[string]*WildcardQuery          `json:"wildcard,omitempty"`            // simple, WildcardQuery
	Term              map[string]*TermQuery              `json:"term,omitempty"`                // simple, TermQuery
	Terms             map[string]*TermsQuery             `json:"terms,omitempty"`               // .
	TermsSet          map[string]*TermsSetQuery          `json:"terms_set,omitempty"`           // TODO: not implemented
	GeoBoundingBox    interface{}                        `json:"geo_bounding_box,omitempty"`    // simple, GeoBoundingBoxQuery
	GeoDistance       interface{}                        `json:"geo_distance,omitempty"`        // simple, GeoDistanceQuery
	GeoPolygon        interface{}                        `json:"geo_polygon,omitempty"`         // simple, GeoPolygonQuery
	GeoShape          interface{}                        `json:"geo_shape,omitempty"`           // TODO: not implemented
	Knn               interface{}                        `json:"knn,omitempty"`                 // simple, KnnQuery
	ConstantScore     *ConstantScoreQuery                `json:"constant_score,omitempty"`      // .
	DisMax            *DisMaxQuery                       `json:"dis_max,omitempty"`             // .
	Nested            *NestedQuery                       `json:"nested,omitempty"`              // .
	HasChild          *HasChildQuery                     `json:"has_child,omitempty"`           // .
	HasParent         *HasParentQuery                    `json:"has_parent,omitempty"`          // .
	ParentID          *ParentIDQuery                     `json:"parent_id,omitempty"`           // .
	FunctionScore     *FunctionScoreQuery                `json:"function_score,omitempty"`      // .
}

type QueryForSDK

type QueryForSDK struct {
	Bool              *BoolQueryForSDK                   `json:"bool,omitempty"`                // .
	Match             map[string]*MatchQuery             `json:"match,omitempty"`               // simple, MatchQuery
	MatchBoolPrefix   map[string]*MatchBoolPrefixQuery   `json:"match_bool_prefix,omitempty"`   // simple, MatchBoolPrefixQuery
	MatchPhrase       map[string]*MatchPhraseQuery       `json:"match_phrase,omitempty"`        // simple, MatchPhraseQuery
	MatchPhrasePrefix map[string]*MatchPhrasePrefixQuery `json:"match_phrase_prefix,omitempty"` // simple, MatchPhrasePrefixQuery
	MultiMatch        *MultiMatchQuery                   `json:"multi_match,omitempty"`         // .
	MatchAll          *MatchAllQuery                     `json:"match_all,omitempty"`           // just set or null
	MatchNone         *MatchNoneQuery                    `json:"match_none,omitempty"`          // just set or null
	QueryString       *QueryStringQuery                  `json:"query_string,omitempty"`        // .
	SimpleQueryString *SimpleQueryStringQuery            `json:"simple_query_string,omitempty"` // .
	Exists            *ExistsQuery                       `json:"exists,omitempty"`              // .
	Ids               *IdsQuery                          `json:"ids,omitempty"`                 // .
	Range             map[string]*RangeQueryForSDK       `json:"range,omitempty"`               // simple, FuzzyQuery
	Regexp            map[string]*RegexpQuery            `json:"regexp,omitempty"`              // simple, FuzzyQuery
	Prefix            map[string]*PrefixQuery            `json:"prefix,omitempty"`              // .
	Fuzzy             map[string]*FuzzyQuery             `json:"fuzzy,omitempty"`               // simple, PrefixQuery
	Wildcard          map[string]*WildcardQuery          `json:"wildcard,omitempty"`            // simple, WildcardQuery
	Term              map[string]*TermQueryForSDK        `json:"term,omitempty"`                // simple, TermQuery
	Terms             map[string]*TermsQuery             `json:"terms,omitempty"`               // .
}

type QueryStringQuery

type QueryStringQuery struct {
	Query           string   `json:"query,omitempty"`
	Analyzer        string   `json:"analyzer,omitempty"`
	Fields          []string `json:"fields,omitempty"`
	DefaultField    string   `json:"default_field,omitempty"`
	DefaultOperator string   `json:"default_operator,omitempty"` // or(default), and
	Boost           float64  `json:"boost,omitempty"`
}

type Range

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

type RangeQuery

type RangeQuery struct {
	GT       interface{} `json:"gt,omitempty"`        // null, float64
	GTE      interface{} `json:"gte,omitempty"`       // null, float64
	LT       interface{} `json:"lt,omitempty"`        // null, float64
	LTE      interface{} `json:"lte,omitempty"`       // null, float64
	Format   string      `json:"format,omitempty"`    // Date format used to convert date values in the query.
	TimeZone string      `json:"time_zone,omitempty"` // used to convert date values in the query to UTC.
	Boost    float64     `json:"boost,omitempty"`
}

RangeQuery {"range":{"field":{"gte":10,"lte":20}}}

type RangeQueryForSDK

type RangeQueryForSDK struct {
	GT       string  `json:"gt,omitempty"`        // string, float64
	GTE      string  `json:"gte,omitempty"`       // string, float64
	LT       string  `json:"lt,omitempty"`        // string, float64
	LTE      string  `json:"lte,omitempty"`       // string, float64
	Format   string  `json:"format,omitempty"`    // Date format used to convert date values in the query.
	TimeZone string  `json:"time_zone,omitempty"` // used to convert date values in the query to UTC.
	Boost    float64 `json:"boost,omitempty"`
}

type RegexpQuery

type RegexpQuery struct {
	Value string  `json:"value,omitempty"`
	Flags string  `json:"flags,omitempty"`
	Boost float64 `json:"boost,omitempty"`
}

RegexpQuery {"regexp":{"field":{"value":"[0-9]*"}}}

type Role

type Role struct {
	ID         string    `json:"_id"`
	Name       string    `json:"name"`
	Role       string    `json:"role"`
	Permission []string  `json:"permission"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

type SearchResponse

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

SearchResponse for a query

type Shards

type Shards struct {
	Total      int64 `json:"total"`
	Successful int64 `json:"successful"`
	Skipped    int64 `json:"skipped"`
	Failed     int64 `json:"failed"`
}

type SimpleQueryStringQuery

type SimpleQueryStringQuery struct {
	Query           string   `json:"query,omitempty"`
	Analyzer        string   `json:"analyzer,omitempty"`
	Fields          []string `json:"fields,omitempty"`
	DefaultOperator string   `json:"default_operator,omitempty"` // or(default), and
	AllFields       bool     `json:"all_fields,omitempty"`
	Boost           float64  `json:"boost,omitempty"`
}

type Source

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

type SourceMapping added in v1.3.0

type SourceMapping struct {
	Enabled bool `json:"enabled"`
}

SourceMapping set to {"enabled": false} does not store the original document: hits and get return no _source, and reindex is rejected.

type SourceVectors added in v1.3.0

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

SourceVectors restores the vectors excluded from _source while the stored fields of documents are visited: Reset, Visit each field, then Restore. A nil SourceVectors, for mappings without vector fields, restores nothing.

func NewSourceVectors added in v1.3.0

func NewSourceVectors(fields []string) *SourceVectors

NewSourceVectors returns a SourceVectors for the vector fields, nil when there are none.

func (*SourceVectors) Fields added in v1.3.0

func (v *SourceVectors) Fields() []string

Fields returns the stored fields Visit consumes.

func (*SourceVectors) Reset added in v1.3.0

func (v *SourceVectors) Reset()

Reset forgets the fields of the previous document.

func (*SourceVectors) Restore added in v1.3.0

func (v *SourceVectors) Restore(source []byte) ([]byte, error)

Restore returns source with the excluded vectors of the visited document, unchanged when it had none.

func (*SourceVectors) Visit added in v1.3.0

func (v *SourceVectors) Visit(field string, value []byte) bool

Visit records a stored field and reports whether it was consumed. Values are copied, visitors reuse their buffers.

type Template

type Template struct {
	Name          string         `json:"name"`
	IndexTemplate *IndexTemplate `json:"index_template"`
}

type TemplateTemplate

type TemplateTemplate struct {
	Settings *IndexSettings `json:"settings,omitempty"`
	Mappings *Mappings      `json:"mappings,omitempty"`
}

type TermQuery

type TermQuery struct {
	Value           interface{} `json:"value,omitempty"`
	Boost           float64     `json:"boost,omitempty"`
	CaseInsensitive bool        `json:"case_insensitive,omitempty"`
}

TermQuery {"term":{"field": "value"}} {"term":{"field": {"value": "value", "boost": 1.0}}}

type TermQueryForSDK

type TermQueryForSDK struct {
	Value           string  `json:"value,omitempty"`
	Boost           float64 `json:"boost,omitempty"`
	CaseInsensitive bool    `json:"case_insensitive,omitempty"`
}

type TermsQuery

type TermsQuery map[string]interface{}

TermsQuery {"terms": {"field": ["value1", "value2"], "boost": 1.0}}

type TermsSetQuery

type TermsSetQuery struct{}

TermsSetQuery ...

type TokenFilter

type TokenFilter struct {
	Type string `json:"type"`
}

type Tokenizer

type Tokenizer struct {
	Type string `json:"type"`
}

type Total

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

type User

type User struct {
	ID        string    `json:"_id"`
	Name      string    `json:"name"`
	Role      string    `json:"role"`
	Salt      string    `json:"salt,omitempty"`
	Password  string    `json:"password,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type VectorIndexOptions

type VectorIndexOptions struct {
	// Type is VectorIndexHNSW or VectorIndexInt8HNSW; empty, as persisted
	// before types, builds int8 graphs.
	Type           string `json:"type,omitempty"`
	M              int    `json:"m,omitempty"`
	EfConstruction int    `json:"ef_construction,omitempty"`
}

VectorIndexOptions are the HNSW graph parameters of a vector field. Zero values take riot's defaults. Persisted graphs are keyed by them.

func (*VectorIndexOptions) Quantization added in v1.3.0

func (o *VectorIndexOptions) Quantization() hnsw.Quantization

Quantization returns the vectors HNSW graphs of o compare. Searches rescore with float32 vectors either way.

type VersionResponse

type VersionResponse struct {
	Version    string `json:"version"`
	Build      string `json:"build"`
	CommitHash string `json:"commit_hash"`
	Branch     string `json:"branch"`
	BuildDate  string `json:"build_date"`
}

type WildcardQuery

type WildcardQuery struct {
	Value string  `json:"value,omitempty"`
	Boost float64 `json:"boost,omitempty"`
}

WildcardQuery {"wildcard": {"field": "*query*"}} {"wildcard": {"field": {"value": "*query*", "boost": 1.0}}}

type ZedQuery

type ZedQuery struct {
	Query          interface{}             `json:"query"`
	Knn            interface{}             `json:"knn,omitempty"` // top-level knn: one object or an array, ORed with query
	Aggregations   map[string]Aggregations `json:"aggs"`
	Highlight      *Highlight              `json:"highlight"`
	Fields         interface{}             `json:"fields"`  // ["field1", "field2.*", {"field": "fieldName", "format": "epoch_millis"}]
	Source         interface{}             `json:"_source"` // true, false, ["field1", "field2.*"]
	Sort           interface{}             `json:"sort"`    // "_score", ["+Year","-Year", {"Year": "desc"}, "Date": {"order": "asc"", "format": "yyyy-MM-dd"}}"}]
	Explain        bool                    `json:"explain"`
	From           int                     `json:"from"`
	Size           int                     `json:"size"`
	Timeout        int                     `json:"timeout"`
	TrackTotalHits bool                    `json:"track_total_hits"`
}

ZedQuery is the query object for the zed index. compatible ES Query DSL

type ZedQueryForSDK

type ZedQueryForSDK struct {
	Query          QueryForSDK             `json:"query"`
	Aggregations   map[string]Aggregations `json:"aggs"`
	Highlight      *Highlight              `json:"highlight"`
	Fields         []string                `json:"fields"`  // ["field1", "field2.*", {"field": "fieldName", "format": "epoch_millis"}]
	Source         []string                `json:"_source"` // true, false, ["field1", "field2.*"]
	Sort           []string                `json:"sort"`    // "_score", ["+Year","-Year", {"Year": "desc"}, "Date": {"order": "asc"", "format": "yyyy-MM-dd"}}"}]
	Explain        bool                    `json:"explain"`
	From           int                     `json:"from"`
	Size           int                     `json:"size"`
	Timeout        int                     `json:"timeout"`
	TrackTotalHits bool                    `json:"track_total_hits"`
}

Directories

Path Synopsis
Package elastic holds the ElasticSearch specific meta declarations and util functions.
Package elastic holds the ElasticSearch specific meta declarations and util functions.

Jump to

Keyboard shortcuts

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