Documentation
¶
Index ¶
- func ExecuteEsSearch(ctx context.Context, client *elastic.Client, indexName string, ...) (*elastic.SearchResult, error)
- func GenerateBoolFilterQuery(filters []elastic.Query) *elastic.BoolQuery
- func GenerateBoolMustNotQuery(fieldName string, fieldValue interface{}) *elastic.BoolQuery
- func GenerateBoolShouldQuery(queries []elastic.Query) *elastic.BoolQuery
- func GenerateMatchAllQuery() *elastic.MatchAllQuery
- func GenerateMatchQuery(fieldName string, fieldValue interface{}) *elastic.MatchQuery
- func GenerateNestedQuery(path string, query elastic.Query) *elastic.NestedQuery
- func GenerateQueryStringQuery(fieldName string, fieldValue interface{}) *elastic.QueryStringQuery
- func GenerateRangeQueryGt(fieldName string, val interface{}) *elastic.RangeQuery
- func GenerateRangeQueryGte(fieldName string, val interface{}) *elastic.RangeQuery
- func GenerateRangeQueryLt(fieldName string, val interface{}) *elastic.RangeQuery
- func GenerateRangeQueryLte(fieldName string, val interface{}) *elastic.RangeQuery
- func GenerateRegexpQuery(fieldName string, fieldValue interface{}) *elastic.RegexpQuery
- func GenerateTermQuery(fieldName string, fieldValue interface{}) *elastic.TermQuery
- func GetIndexMapping() string
- func NewESClient() (*elastic.Client, error)
- type AuthorBioData
- type AuthorStatData
- type Name
- type People
- type Post
- type Stat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteEsSearch ¶
func ExecuteEsSearch(ctx context.Context, client *elastic.Client, indexName string, query elastic.Query) (*elastic.SearchResult, error)
ExecuteEsSearch executes ES query.
func GenerateBoolFilterQuery ¶
GenerateBoolFilterQuery returns an ES Filter Bool Query.
func GenerateBoolMustNotQuery ¶
GenerateBoolMustNotQuery returns an ES Must Not Bool Query.
func GenerateBoolShouldQuery ¶
GenerateBoolShouldQuery returns an ES Should Bool Query.
func GenerateMatchAllQuery ¶
func GenerateMatchAllQuery() *elastic.MatchAllQuery
GenerateMatchAllQuery returns an ES MatchAll Query.
func GenerateMatchQuery ¶
func GenerateMatchQuery(fieldName string, fieldValue interface{}) *elastic.MatchQuery
GenerateMatchQuery returns an ES Match Query.
func GenerateNestedQuery ¶
func GenerateNestedQuery(path string, query elastic.Query) *elastic.NestedQuery
GenerateNestedQuery returns an ES Nested Query.
func GenerateQueryStringQuery ¶
func GenerateQueryStringQuery(fieldName string, fieldValue interface{}) *elastic.QueryStringQuery
GenerateQueryStringQuery returns an ES Query String Query.
func GenerateRangeQueryGt ¶
func GenerateRangeQueryGt(fieldName string, val interface{}) *elastic.RangeQuery
GenerateRangeQueryGt returns an ES Greater Than Range Query.
func GenerateRangeQueryGte ¶
func GenerateRangeQueryGte(fieldName string, val interface{}) *elastic.RangeQuery
GenerateRangeQueryGte returns an ES Greater Than or Equal Range Query.
func GenerateRangeQueryLt ¶
func GenerateRangeQueryLt(fieldName string, val interface{}) *elastic.RangeQuery
GenerateRangeQueryLt returns an ES Less Than Range Query.
func GenerateRangeQueryLte ¶
func GenerateRangeQueryLte(fieldName string, val interface{}) *elastic.RangeQuery
GenerateRangeQueryLte returns an ES Less Than or Equal Range Query.
func GenerateRegexpQuery ¶
func GenerateRegexpQuery(fieldName string, fieldValue interface{}) *elastic.RegexpQuery
GenerateRegexpQuery returns an ES Regexp Query.
func GenerateTermQuery ¶
GenerateTermQuery returns an ES Term Query.
func NewESClient ¶
NewESClient returns an Elasticsearch client.
Types ¶
type AuthorBioData ¶
type AuthorBioData struct { Country string `json:"country"` State string `json:"state"` City string `json:"city"` }
AuthorBioData describes author's bio.
type AuthorStatData ¶
type AuthorStatData struct {
AuthorBio AuthorBioData `json:"authorbio"`
}
AuthorStatData decribes author's stat data.
type Post ¶
type Post struct { ID string `json:"id"` Author string `json:"author"` Message string `json:"message"` Department string `json:"department"` Email string `json:"email"` Clearance int `json:"clearance"` Action string `json:"action"` Resource string `json:"resource"` Conditions []map[string]string `json:"conditions"` Likes []map[string]string `json:"likes"` Followers []People `json:"followers"` Stats []Stat `json:"stats"` }
Post is a structure used for serializing/deserializing data in Elasticsearch.
func GetPrettyESResult ¶
func GetPrettyESResult(searchResult *elastic.SearchResult) []Post
GetPrettyESResult returns formatted ES results.
type Stat ¶
type Stat struct {
AuthorStat AuthorStatData `json:"authorstat"`
}
Stat decribes author's stats.