meta

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

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"
)

Variables

View Source
var (
	// Version is the version of the program - Git tag - git describe --tags --always
	Version = "v0.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 = "0"
	// 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/zincsearch/zincsearch/pkg/meta.Version=$VERSION" -o zincsearch

View Source
var SEGMENT_CLIENT analytics.Client

Functions

func GUI

func GUI(c *gin.Context)

GUI function gets all events

func GetHealthz

func GetHealthz(c *gin.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 *gin.Context)

GetVersion returns the version of the program

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

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 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 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 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 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
}

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"`
	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
	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 DateRange

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

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 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 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 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 IndexSecondShard

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

type IndexSettings

type IndexSettings struct {
	NumberOfShards   int64          `json:"number_of_shards,omitempty"`
	NumberOfReplicas int64          `json:"number_of_replicas,omitempty"`
	Analysis         *IndexAnalysis `json:"analysis,omitempty"`
}

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      *bluge.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"`
	// contains filtered or unexported fields
}

func NewMappings

func NewMappings() *Mappings

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) SetProperty

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

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 Page

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

func NewPage

func NewPage(c *gin.Context) *Page

func (*Page) GetStartEndIndex

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

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
	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
	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"`
}

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"`    // TODO: not implemented
	GeoDistance       interface{}                        `json:"geo_distance,omitempty"`        // TODO: not implemented
	GeoPolygon        interface{}                        `json:"geo_polygon,omitempty"`         // TODO: not implemented
	GeoShape          interface{}                        `json:"geo_shape,omitempty"`           // TODO: not implemented
}

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 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 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 ZincQuery

type ZincQuery struct {
	Query          interface{}             `json:"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"`
}

ZincQuery is the query object for the zinc index. compatible ES Query DSL

type ZincQueryForSDK

type ZincQueryForSDK 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