summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/olivere/elastic.v5/search.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-16 05:37:14 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-04-16 08:37:14 -0400
commit6e2cb00008cbf09e556b00f87603797fcaa47e09 (patch)
tree3c0eb55ff4226a3f024aad373140d1fb860a6404 /vendor/gopkg.in/olivere/elastic.v5/search.go
parentbf24f51c4e1cc6286885460672f7f449e8c6f5ef (diff)
downloadchat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.gz
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.bz2
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.zip
Depenancy upgrades and movign to dep. (#8630)
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/search.go')
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search.go b/vendor/gopkg.in/olivere/elastic.v5/search.go
index 12d51bf1f..a9eb212f4 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search.go
@@ -12,7 +12,7 @@ import (
"reflect"
"strings"
- "github.com/olivere/elastic/uritemplates"
+ "gopkg.in/olivere/elastic.v5/uritemplates"
)
// Search for documents in Elasticsearch.
@@ -60,7 +60,7 @@ func (s *SearchService) Source(source interface{}) *SearchService {
// FilterPath allows reducing the response, a mechanism known as
// response filtering and described here:
-// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/common-options.html#common-options-response-filtering.
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#common-options-response-filtering.
func (s *SearchService) FilterPath(filterPath ...string) *SearchService {
s.filterPath = append(s.filterPath, filterPath...)
return s
@@ -110,10 +110,16 @@ func (s *SearchService) TimeoutInMillis(timeoutInMillis int) *SearchService {
return s
}
+// TerminateAfter specifies the maximum number of documents to collect for
+// each shard, upon reaching which the query execution will terminate early.
+func (s *SearchService) TerminateAfter(terminateAfter int) *SearchService {
+ s.searchSource = s.searchSource.TerminateAfter(terminateAfter)
+ return s
+}
+
// SearchType sets the search operation type. Valid values are:
-// "query_then_fetch", "query_and_fetch", "dfs_query_then_fetch",
-// "dfs_query_and_fetch", "count", "scan".
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-search-type.html
+// "dfs_query_then_fetch" and "query_then_fetch".
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-search-type.html
// for details.
func (s *SearchService) SearchType(searchType string) *SearchService {
s.searchType = searchType
@@ -278,7 +284,7 @@ func (s *SearchService) TrackScores(trackScores bool) *SearchService {
// SearchAfter allows a different form of pagination by using a live cursor,
// using the results of the previous page to help the retrieval of the next.
//
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-search-after.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-search-after.html
func (s *SearchService) SearchAfter(sortValues ...interface{}) *SearchService {
s.searchSource = s.searchSource.SearchAfter(sortValues...)
return s
@@ -392,12 +398,7 @@ func (s *SearchService) Do(ctx context.Context) (*SearchResult, error) {
}
body = src
}
- res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
- Method: "POST",
- Path: path,
- Params: params,
- Body: body,
- })
+ res, err := s.client.PerformRequest(ctx, "POST", path, params, body)
if err != nil {
return nil, err
}
@@ -413,7 +414,7 @@ func (s *SearchService) Do(ctx context.Context) (*SearchResult, error) {
// SearchResult is the result of a search in Elasticsearch.
type SearchResult struct {
TookInMillis int64 `json:"took"` // search time in milliseconds
- ScrollId string `json:"_scroll_id"` // only used with Scroll and Scan operations
+ ScrollId string `json:"_scroll_id"` // only used with Scroll operations
Hits *SearchHits `json:"hits"` // the actual search hits
Suggest SearchSuggest `json:"suggest"` // results from suggesters
Aggregations Aggregations `json:"aggregations"` // results from aggregations
@@ -434,8 +435,7 @@ func (r *SearchResult) TotalHits() int64 {
// Each is a utility function to iterate over all hits. It saves you from
// checking for nil values. Notice that Each will ignore errors in
-// serializing JSON and hits with empty/nil _source will get an empty
-// value
+// serializing JSON.
func (r *SearchResult) Each(typ reflect.Type) []interface{} {
if r.Hits == nil || r.Hits.Hits == nil || len(r.Hits.Hits) == 0 {
return nil
@@ -490,7 +490,7 @@ type SearchHitInnerHits struct {
}
// SearchExplanation explains how the score for a hit was computed.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-explain.html.
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-explain.html.
type SearchExplanation struct {
Value float64 `json:"value"` // e.g. 1.0
Description string `json:"description"` // e.g. "boost" or "ConstantScore(*:*), product of:"
@@ -500,11 +500,11 @@ type SearchExplanation struct {
// Suggest
// SearchSuggest is a map of suggestions.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-suggesters.html.
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-suggesters.html.
type SearchSuggest map[string][]SearchSuggestion
// SearchSuggestion is a single search suggestion.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-suggesters.html.
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-suggesters.html.
type SearchSuggestion struct {
Text string `json:"text"`
Offset int `json:"offset"`
@@ -513,7 +513,7 @@ type SearchSuggestion struct {
}
// SearchSuggestionOption is an option of a SearchSuggestion.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-suggesters.html.
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-suggesters.html.
type SearchSuggestionOption struct {
Text string `json:"text"`
Index string `json:"_index"`
@@ -576,6 +576,6 @@ type ProfileResult struct {
// Highlighting
// SearchHitHighlight is the highlight information of a search hit.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-highlighting.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-highlighting.html
// for a general discussion of highlighting.
type SearchHitHighlight map[string][]string