Documentation ¶
Index ¶
- Constants
- Variables
- func DocumentSearchAmountFilterGet(ctx context.Context, getSearchService func() (*elastic.SearchService, int64), ...) (interface{}, map[string]interface{}, errors.E)
- func DocumentSearchFiltersGet(ctx context.Context, getSearchService func() (*elastic.SearchService, int64), ...) (interface{}, map[string]interface{}, errors.E)
- func DocumentSearchIndexFilterGet(ctx context.Context, getSearchService func() (*elastic.SearchService, int64), ...) (interface{}, map[string]interface{}, errors.E)
- func DocumentSearchRelFilterGet(ctx context.Context, getSearchService func() (*elastic.SearchService, int64), ...) (interface{}, map[string]interface{}, errors.E)
- func DocumentSearchSizeFilterGet(ctx context.Context, getSearchService func() (*elastic.SearchService, int64), ...) (interface{}, map[string]interface{}, errors.E)
- func DocumentSearchStringFilterGet(ctx context.Context, getSearchService func() (*elastic.SearchService, int64), ...) (interface{}, map[string]interface{}, errors.E)
- func DocumentSearchTimeFilterGet(ctx context.Context, getSearchService func() (*elastic.SearchService, int64), ...) (interface{}, map[string]interface{}, errors.E)
- func EnsureIndex(ctx context.Context, httpClient *http.Client, logger zerolog.Logger, ...) (*elastic.Client, errors.E)
- func GetClient(httpClient *http.Client, logger zerolog.Logger, url string) (*elastic.Client, errors.E)
- type State
Constants ¶
const (
MaxResultsCount = 1000
)
Variables ¶
var ( ErrNotFound = errors.Base("not found") ErrInvalidArgument = errors.Base("invalid argument") )
Functions ¶
func DocumentSearchAmountFilterGet ¶
func DocumentSearchAmountFilterGet( ctx context.Context, getSearchService func() (*elastic.SearchService, int64), id, prop identifier.Identifier, unit string, ) (interface{}, map[string]interface{}, errors.E)
func DocumentSearchFiltersGet ¶
func DocumentSearchFiltersGet( ctx context.Context, getSearchService func() (*elastic.SearchService, int64), id identifier.Identifier, ) (interface{}, map[string]interface{}, errors.E)
func DocumentSearchIndexFilterGet ¶
func DocumentSearchIndexFilterGet( ctx context.Context, getSearchService func() (*elastic.SearchService, int64), id identifier.Identifier, ) (interface{}, map[string]interface{}, errors.E)
func DocumentSearchRelFilterGet ¶
func DocumentSearchRelFilterGet( ctx context.Context, getSearchService func() (*elastic.SearchService, int64), id, prop identifier.Identifier, ) (interface{}, map[string]interface{}, errors.E)
func DocumentSearchSizeFilterGet ¶
func DocumentSearchSizeFilterGet( ctx context.Context, getSearchService func() (*elastic.SearchService, int64), id identifier.Identifier, ) (interface{}, map[string]interface{}, errors.E)
func DocumentSearchStringFilterGet ¶
func DocumentSearchStringFilterGet( ctx context.Context, getSearchService func() (*elastic.SearchService, int64), id, prop identifier.Identifier, ) (interface{}, map[string]interface{}, errors.E)
func DocumentSearchTimeFilterGet ¶
func DocumentSearchTimeFilterGet( ctx context.Context, getSearchService func() (*elastic.SearchService, int64), id, prop identifier.Identifier, ) (interface{}, map[string]interface{}, errors.E)
func EnsureIndex ¶
func EnsureIndex(ctx context.Context, httpClient *http.Client, logger zerolog.Logger, url, index string, sizeField bool) (*elastic.Client, errors.E)
EnsureIndex creates an instance of the ElasticSearch client and makes sure the index for PeerDB documents exists. If not, it creates it. It does not update configuration of an existing index if it is different from what current implementation of EnsureIndex would otherwise create.
Types ¶
type State ¶
type State struct { ID identifier.Identifier `json:"s"` Text string `json:"q"` Filters *filters `json:"-"` ParentID *identifier.Identifier `json:"-"` RootID identifier.Identifier `json:"-"` }
State represents current search state. Search states form a tree with a link to the previous (parent) state.
func CreateState ¶
CreateState creates a new search state given optional existing state and new queries.
func GetOrCreateState ¶
GetOrCreateState resolves an existing search state if possible. If not, it creates a new search state.
func (*State) Query ¶
func (q *State) Query() elastic.Query
TODO: Determine which operator should be the default? TODO: Make sure right analyzers are used for all fields. TODO: Limit allowed syntax for simple queries (disable fuzzy matching).