Documentation
¶
Overview ¶
Copyright 2019 txn2 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func GetQueryTemplateMapping() es.IndexTemplate
- type Api
- func (a *Api) ExecuteQuery(account string, query Query) (int, *es.Obj, error)
- func (a *Api) ExecuteQueryHandler(c *gin.Context)
- func (a *Api) GetQuery(account string, id string) (int, *Result, error)
- func (a *Api) GetQueryHandler(c *gin.Context)
- func (a *Api) RunQueryHandler(c *gin.Context)
- func (a *Api) SearchQueries(account string, searchObj *es.Obj) (int, SearchResults, error)
- func (a *Api) SearchQueryHandler(c *gin.Context)
- func (a *Api) UpsertQuery(account string, query *Query) (int, es.Result, error)
- func (a *Api) UpsertQueryHandler(c *gin.Context)
- type Config
- type Query
- type Result
- type SearchResults
- type SearchResultsAck
Constants ¶
const IdxQuery = "queries"
Variables ¶
This section is empty.
Functions ¶
func GetQueryTemplateMapping ¶
func GetQueryTemplateMapping() es.IndexTemplate
GetModelsTemplateMapping
Types ¶
type Api ¶
type Api struct {
*Config
}
Api
func (*Api) ExecuteQuery ¶
ExecuteQuery
func (*Api) ExecuteQueryHandler ¶
ExecuteQueryHandler
func (*Api) SearchQueries ¶
SearchModels
func (*Api) SearchQueryHandler ¶
SearchQueryHandler
func (*Api) UpsertQuery ¶
UpsertQuery
func (*Api) UpsertQueryHandler ¶
UpsertQueryHandler
type Config ¶
type Config struct {
Logger *zap.Logger
HttpClient *micro.Client
// used for communication with Elasticsearch
// if nil, HttpClient will be used.
Elastic *es.Client
ElasticServer string
}
Config
type Query ¶
type Query struct {
// a lowercase under score delimited uniq id
MachineName string `json:"machine_name" mapstructure:"machine_name"`
// short human readable display name
DisplayName string `json:"display_name" mapstructure:"display_name"`
// a single sentence description
BriefDescription string `json:"description_brief" mapstructure:"description_brief"`
// full documentation in markdown
Description string `json:"description" mapstructure:"description"`
// named parsers
Parsers []string `json:"parsers" mapstructure:"parsers"`
// belongs to a class of queries
QueryClass string `json:"query_class" mapstructure:"query_class"`
// used for grouping queries
Group string `json:"group" mapstructure:"group"`
// used for grouping queries
Model string `json:"model" mapstructure:"model"`
// pattern default "-*" eg. "-someset", "-ts-2019*"
IdxPattern string `json:"idx_pattern" mapstructure:"idx_pattern"`
// query object
Query *es.Obj `json:"query,omitempty" mapstructure:"query"`
// query json
QueryJson string `json:"query_json,omitempty" mapstructure:"query_json"`
// describes the query output
ResultFields []tm.Model `json:"fields" mapstructure:"fields"`
}
Query
type SearchResults ¶
type SearchResults struct {
es.SearchResults
Hits struct {
Total int `json:"total"`
MaxScore float64 `json:"max_score"`
Hits []Result `json:"hits"`
} `json:"hits"`
}
ModelSearchResults
type SearchResultsAck ¶
type SearchResultsAck struct {
ack.Ack
Payload SearchResults `json:"payload"`
}
AccountSearchResultsAck