elastic

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*QueryGenerator)

Option is a function that configures a query generator.

func WithFieldValidator

func WithFieldValidator(fieldValidator func(name string) error) Option

WithFieldValidator allows checking incoming field names. This can be used to prevent users from querying fields that they are not allowed to query. Example usage:

WithFieldValidator(func(name string) error {
	if !allowedFields[name] {
		return fmt.Errorf("field %s is not allowed", name)
	}
	return nil
})

type QueryGenerator

type QueryGenerator struct {
	// contains filtered or unexported fields
}

func NewQueryGenerator

func NewQueryGenerator(options ...Option) *QueryGenerator

func (*QueryGenerator) ConvertAST

func (q *QueryGenerator) ConvertAST(root kqlfilter.Node) (types.Query, error)

ConvertAST converts a KQL AST to an Elasticsearch query.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL