Documentation
¶
Index ¶
- Constants
- Variables
- func CheckIndexType(indexType string) error
- func ExcludeSourceVectors(source map[string]interface{}, fields []string) (map[string]interface{}, []byte, error)
- func GUI(c zhttp.Context)
- func GetHealthz(c zhttp.Context)
- func GetVersion(c zhttp.Context)
- func LookupPath(m map[string]interface{}, path string) (interface{}, bool)
- func ParseVector(v interface{}, dims int) ([]float32, error)
- func ParseVectorMetric(name string) (riot.Metric, error)
- func RestoreSourceVectors(source []byte, stored map[string][]byte) ([]byte, error)
- type AggregationAutoDateHistogram
- type AggregationBucketScript
- type AggregationBucketSort
- type AggregationDateHistogram
- type AggregationDateRange
- type AggregationExtendedStats
- type AggregationFilters
- type AggregationHistogram
- type AggregationHit
- type AggregationHits
- type AggregationIPRange
- type AggregationMetric
- type AggregationMovingFn
- type AggregationMultiTerms
- type AggregationNested
- type AggregationPercentileRanks
- type AggregationPercentiles
- type AggregationPipeline
- type AggregationRange
- type AggregationResponse
- type AggregationSerialDiff
- type AggregationSignificantTerms
- type AggregationStdDeviationBounds
- type AggregationTopHits
- type Aggregations
- type AggregationsTerms
- type Analyzer
- type BoolQuery
- type BoolQueryForSDK
- type BoostingQuery
- type CombinedFieldsQuery
- type ConstantScoreQuery
- type DateRange
- type DisMaxQuery
- type ExistsQuery
- type Field
- type FunctionScoreQuery
- type FuzzyQuery
- type GeoPoint
- type HTTPResponse
- type HTTPResponseDeleteByQuery
- type HTTPResponseDocument
- type HTTPResponseESID
- type HTTPResponseError
- type HTTPResponseID
- type HTTPResponseIndex
- type HTTPResponseRecordCount
- type HTTPResponseTemplate
- type HasChildQuery
- type HasParentQuery
- type HealthzResponse
- type Highlight
- type Hit
- type Hits
- type HttpRetriesResponse
- type IPRange
- type IdsQuery
- type Index
- type IndexAnalysis
- type IndexLifecycle
- type IndexSecondShard
- type IndexSettings
- type IndexShard
- type IndexShardV026
- type IndexSimple
- type IndexStat
- type IndexTemplate
- type IndexV026
- type JSONIngest
- type Mappings
- func (t *Mappings) AddVectorFields(fields ...string)
- func (t *Mappings) AllEnabled() bool
- func (t *Mappings) DeepClone() *Mappings
- func (t *Mappings) GetProperty(field string) (Property, bool)
- func (t *Mappings) Len() int
- func (t *Mappings) ListProperty() map[string]Property
- func (t *Mappings) MarshalJSON() ([]byte, error)
- func (t *Mappings) RangeProperty(fn func(field string, prop Property) bool)
- func (t *Mappings) SetAllEnabled(enabled bool)
- func (t *Mappings) SetProperty(field string, prop Property)
- func (t *Mappings) SetSourceEnabled(enabled bool)
- func (t *Mappings) SourceEnabled() bool
- func (t *Mappings) VectorFields() []string
- type MatchAllQuery
- type MatchBoolPrefixQuery
- type MatchNoneQuery
- type MatchPhrasePrefixQuery
- type MatchPhraseQuery
- type MatchQuery
- type MultiMatchQuery
- type NestedQuery
- type Page
- type ParentIDQuery
- type PrefixQuery
- type Property
- type Query
- type QueryForSDK
- type QueryRule
- type QueryRuleActions
- type QueryRuleCriteria
- type QueryRuleDocRef
- type QueryRuleset
- type QueryStringQuery
- type Range
- type RangeQuery
- type RangeQueryForSDK
- type RegexpQuery
- type Role
- type SearchResponse
- type Shards
- type SignificanceHeuristic
- type SimpleQueryStringQuery
- type Source
- type SourceMapping
- type SourceVectors
- type SynonymRule
- type SynonymSet
- type Template
- type TemplateTemplate
- type TermQuery
- type TermQueryForSDK
- type TermsQuery
- type TermsSetQuery
- type TokenFilter
- type Tokenizer
- type Total
- type User
- type VectorIndexOptions
- type VersionResponse
- type WildcardQuery
- type ZedQuery
- type ZedQueryForSDK
Constants ¶
const ( DefaultSignificantTermsSize = 10 DefaultSignificantTermsMinDocCount = 3 // MaxSignificantTermsSize bounds size and shard_size, so that // RequestSize cannot overflow. MaxSignificantTermsSize = 10000 )
const ( IndexTypeStandard = "standard" IndexTypeLogs = "logs" )
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.
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.
const ( TimeFieldName = "@timestamp" IDFieldName = "@_id" ActionFieldName = "@_action" ShardFieldName = "@_shard" SourceFieldName = "@_source" )
Default field name
const ( ActionTypeInsert = "insert" ActionTypeUpdate = "update" ActionTypeDelete = "delete" )
const DefaultOtherBucketKey = "_other_"
DefaultOtherBucketKey is the key elasticsearch gives the other bucket of a [filters] aggregation when other_bucket_key is not set.
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 ¶
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
var SEGMENT_CLIENT analytics.Client
Functions ¶
func CheckIndexType ¶
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 GetHealthz ¶
GetHealthz function gets all events
@Id Healthz @Summary Get healthz @Produce json @Success 200 {object} HealthzResponse @Router /healthz [get]
func GetVersion ¶
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
LookupPath returns the value at a dotted path, as keyPath matches it.
func ParseVector ¶
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 ¶
ParseVectorMetric resolves an Elasticsearch similarity or OpenSearch space_type name to a riot metric.
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 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"`
SortKey *string `json:"_sort_key,omitempty" swaggerignore:"true"` // internal top_hits merge key
}
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 AggregationMetric ¶
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 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 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"`
BgCount *uint64 `json:"bg_count,omitempty"` // significant_terms background size
// 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 AggregationSignificantTerms ¶ added in v1.4.0
type AggregationSignificantTerms struct {
Field string `json:"field"`
Size int `json:"size"` // default 10
ShardSize int `json:"shard_size"` // foreground terms collected before scoring
MinDocCount *int `json:"min_doc_count"` // default 3
BackgroundFilter interface{} `json:"background_filter"`
Include interface{} `json:"include"` // regexp string or array of terms
Exclude interface{} `json:"exclude"` // regexp string or array of terms
JLH *struct{} `json:"jlh"`
MutualInformation *SignificanceHeuristic `json:"mutual_information"`
ChiSquare *SignificanceHeuristic `json:"chi_square"`
GND *SignificanceHeuristic `json:"gnd"`
Percentage *struct{} `json:"percentage"`
// significant_text options, not supported: decoded only to reject
// filter_duplicate_text: true and a non-empty source_fields; hidden from swagger
FilterDuplicateText bool `json:"filter_duplicate_text" swaggerignore:"true"`
SourceFields []string `json:"source_fields" swaggerignore:"true"`
}
AggregationSignificantTerms is the significant_terms (and significant_text) aggregation. At most one heuristic is set, JLH is the default.
func (*AggregationSignificantTerms) RequestSize ¶ added in v1.4.0
func (a *AggregationSignificantTerms) RequestSize() int
RequestSize is the number of foreground terms collected by the underlying terms aggregation: max(shard_size, size*5, 100).
func (*AggregationSignificantTerms) ResponseSize ¶ added in v1.4.0
func (a *AggregationSignificantTerms) ResponseSize() int
ResponseSize is the number of buckets returned, default 10.
type AggregationTopHits ¶
type AggregationTopHits struct {
Size int `json:"size"`
From int `json:"from"`
Sort interface{} `json:"sort"`
Source interface{} `json:"_source"`
IncludeSortKey bool `json:"-"` // enabled by the internal search handler
}
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"`
SignificantTerms *AggregationSignificantTerms `json:"significant_terms"`
SignificantText *AggregationSignificantTerms `json:"significant_text"`
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 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 ConstantScoreQuery ¶
type ConstantScoreQuery struct {
Filter interface{} `json:"filter"`
Boost float64 `json:"boost,omitempty"`
}
ConstantScoreQuery {"constant_score": {"filter": {query}, "boost": 1.2}}
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 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 ¶
GeoPoint is the canonical value of a geo_point field.
func ParseGeoPoint ¶
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 HTTPResponseESID ¶
type HTTPResponseError ¶
type HTTPResponseError struct {
Error string `json:"error"`
}
type HTTPResponseID ¶
type HTTPResponseIndex ¶
type HTTPResponseRecordCount ¶
type HTTPResponseTemplate ¶
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 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 HttpRetriesResponse ¶
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 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 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 IndexTemplate ¶
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 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
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
AllEnabled reports whether documents index the _all field.
func (*Mappings) ListProperty ¶
func (*Mappings) MarshalJSON ¶
func (*Mappings) RangeProperty ¶
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
SetAllEnabled sets the _all mapping.
func (*Mappings) SetProperty ¶
func (*Mappings) SetSourceEnabled ¶ added in v1.3.0
SetSourceEnabled sets the _source mapping.
func (*Mappings) SourceEnabled ¶ added in v1.3.0
SourceEnabled reports whether documents keep their _source.
func (*Mappings) VectorFields ¶ added in v1.3.0
VectorFields returns the indexed vector fields, whose values are stored, and the fields added by AddVectorFields.
type MatchAllQuery ¶
type MatchAllQuery struct{}
type MatchBoolPrefixQuery ¶
type MatchNoneQuery ¶
type MatchNoneQuery struct{}
type MatchPhrasePrefixQuery ¶
type MatchPhraseQuery ¶
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 (*Page) GetStartEndIndex ¶
type ParentIDQuery ¶
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 ¶
type Query ¶
type Query struct {
Bool *BoolQuery `json:"bool,omitempty"` // .
Boosting *BoostingQuery `json:"boosting,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
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 QueryRule ¶ added in v1.4.0
type QueryRule struct {
ID string `json:"rule_id"`
Type string `json:"type"` // pinned, exclude
Criteria []QueryRuleCriteria `json:"criteria"`
Actions QueryRuleActions `json:"actions"`
Priority *int `json:"priority,omitempty"`
}
QueryRule pins or excludes documents when all of its criteria match the match_criteria of a rule query.
type QueryRuleActions ¶ added in v1.4.0
type QueryRuleActions struct {
IDs []string `json:"ids,omitempty"`
Docs []QueryRuleDocRef `json:"docs,omitempty"`
}
QueryRuleActions lists the documents a rule pins or excludes.
type QueryRuleCriteria ¶ added in v1.4.0
type QueryRuleCriteria struct {
Type string `json:"type"`
Metadata string `json:"metadata,omitempty"`
Values []interface{} `json:"values,omitempty"`
}
QueryRuleCriteria compares the match_criteria value named metadata with values: exact, fuzzy, prefix, suffix, contains, lt, lte, gt, gte, always.
type QueryRuleDocRef ¶ added in v1.4.0
QueryRuleDocRef is a document of an index.
type QueryRuleset ¶ added in v1.4.0
QueryRuleset is a named list of query rules, as the Elasticsearch query rules API stores them.
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 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 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"`
Suggest map[string]interface{} `json:"suggest,omitempty"`
Error string `json:"error,omitempty"`
}
SearchResponse for a query
type SignificanceHeuristic ¶ added in v1.4.0
type SignificanceHeuristic struct {
IncludeNegatives bool `json:"include_negatives"` // default false
BackgroundIsSuperset *bool `json:"background_is_superset"` // default true
}
SignificanceHeuristic holds the options of the mutual_information, chi_square and gnd heuristics.
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 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.
type SynonymRule ¶ added in v1.4.0
SynonymRule is a Solr formatted synonym rule of a synonyms set.
type SynonymSet ¶ added in v1.4.0
type SynonymSet struct {
ID string `json:"id"`
Rules []SynonymRule `json:"synonyms_set"`
}
SynonymSet is a stored, named list of synonym rules referenced by the synonyms_set option of the synonym token filters.
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 TermsQuery ¶
type TermsQuery map[string]interface{}
TermsQuery {"terms": {"field": ["value1", "value2"], "boost": 1.0}}
type TokenFilter ¶
type TokenFilter struct {
Type string `json:"type"`
}
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 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"`
Rescore interface{} `json:"rescore,omitempty"` // one rescorer or an array, applied in order
Suggest map[string]interface{} `json:"suggest,omitempty"` // {"text": global, "name": {term|phrase|completion}}
}
ZedQuery is the query object for the zed index. compatible ES Query DSL
type ZedQueryForSDK ¶
type ZedQueryForSDK struct {
Query QueryForSDK `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 []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"`
}