// Search for a given query in the ES index and return a slice of results.
Search for a given query in the ES index and return a slice of results.
// Search for a given query in the ES index and return a slice of results .
func Search(query string) ([]SearchResult, error) {
	if client == nil {
		return nil, fmt.Errorf("Client is nil. Client must be initialized with backend.InitES(URL string)")
	}
	buf, err := createQueryJSON(query)
	if err != nil {
		return nil, err
	}
	res, err := performQuery(buf)
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()
	return parseQueryResponse(res)
}
func Search ( query string ) ( [ ] SearchResult , error ) { if client == nil { return nil , fmt . Errorf ( " " ) } buf , err := createQueryJSON ( query ) if err != nil { return nil , err } res , err := performQuery ( buf ) if err != nil { return nil , err } defer res . Body . Close ( ) return parseQueryResponse ( res ) }
Search for a given query in the ES index and return a slice of results.
Search for a given query in the ES index and return a slice of results .
// Construct the request body. // This runs the query through a search in the name and tags fields. // Perform the search request. // Decode and return response JSON (or any errors)