explore

package
v9.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Explore graph analytics. Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. An initial request to the `_explore` API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. Subsequent requests enable you to spider out from one more vertices of interest. You can exclude vertices that have already been returned.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type Explore

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

func New

Explore graph analytics. Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. An initial request to the `_explore` API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. Subsequent requests enable you to spider out from one more vertices of interest. You can exclude vertices that have already been returned.

https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-graph

func (*Explore) Connections

func (r *Explore) Connections(connections types.HopVariant) *Explore

Specifies or more fields from which you want to extract terms that are associated with the specified vertices. API name: connections

func (*Explore) Controls

func (r *Explore) Controls(controls types.ExploreControlsVariant) *Explore

Direct the Graph API how to build the graph. API name: controls

func (Explore) Do

func (r Explore) Do(providedCtx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a explore.Response

func (*Explore) ErrorTrace

func (r *Explore) ErrorTrace(errortrace bool) *Explore

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace

func (*Explore) FilterPath

func (r *Explore) FilterPath(filterpaths ...string) *Explore

FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path

func (*Explore) Header

func (r *Explore) Header(key, value string) *Explore

Header set a key, value pair in the Explore headers map.

func (*Explore) HttpRequest

func (r *Explore) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*Explore) Human

func (r *Explore) Human(human bool) *Explore

Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"eixsts_time_in_millis": 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human

func (Explore) Perform

func (r Explore) Perform(providedCtx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*Explore) Pretty

func (r *Explore) Pretty(pretty bool) *Explore

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty

func (*Explore) Query

func (r *Explore) Query(query types.QueryVariant) *Explore

A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. API name: query

func (*Explore) Raw

func (r *Explore) Raw(raw io.Reader) *Explore

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*Explore) Request

func (r *Explore) Request(req *Request) *Explore

Request allows to set the request property with the appropriate payload.

func (*Explore) Routing

func (r *Explore) Routing(routing string) *Explore

Routing Custom value used to route operations to a specific shard. API name: routing

func (*Explore) Timeout

func (r *Explore) Timeout(duration string) *Explore

Timeout Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout. API name: timeout

func (*Explore) Vertices

func (r *Explore) Vertices(vertices ...types.VertexDefinitionVariant) *Explore

Specifies one or more fields that contain the terms you want to include in the graph as vertices. API name: vertices

type NewExplore

type NewExplore func(index string) *Explore

NewExplore type alias for index.

func NewExploreFunc

func NewExploreFunc(tp elastictransport.Interface) NewExplore

NewExploreFunc returns a new instance of Explore with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type Request

type Request struct {

	// Connections Specifies or more fields from which you want to extract terms that are
	// associated with the specified vertices.
	Connections *types.Hop `json:"connections,omitempty"`
	// Controls Direct the Graph API how to build the graph.
	Controls *types.ExploreControls `json:"controls,omitempty"`
	// Query A seed query that identifies the documents of interest. Can be any valid
	// Elasticsearch query.
	Query *types.Query `json:"query,omitempty"`
	// Vertices Specifies one or more fields that contain the terms you want to include in
	// the graph as vertices.
	Vertices []types.VertexDefinition `json:"vertices,omitempty"`
}

Request holds the request body struct for the package explore

https://github.com/elastic/elasticsearch-specification/blob/52c473efb1fb5320a5bac12572d0b285882862fb/specification/graph/explore/GraphExploreRequest.ts#L28-L84

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

type Response

type Response struct {
	Connections []types.Connection   `json:"connections"`
	Failures    []types.ShardFailure `json:"failures"`
	TimedOut    bool                 `json:"timed_out"`
	Took        int64                `json:"took"`
	Vertices    []types.Vertex       `json:"vertices"`
}

Response holds the response body struct for the package explore

https://github.com/elastic/elasticsearch-specification/blob/52c473efb1fb5320a5bac12572d0b285882862fb/specification/graph/explore/GraphExploreResponse.ts#L25-L33

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

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