diff options
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/index.go')
-rw-r--r-- | vendor/gopkg.in/olivere/elastic.v5/index.go | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/index.go b/vendor/gopkg.in/olivere/elastic.v5/index.go index a4e4ae0d1..4a4c3278e 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/index.go +++ b/vendor/gopkg.in/olivere/elastic.v5/index.go @@ -9,13 +9,13 @@ import ( "fmt" "net/url" - "gopkg.in/olivere/elastic.v5/uritemplates" + "github.com/olivere/elastic/uritemplates" ) // IndexService adds or updates a typed JSON document in a specified index, // making it searchable. // -// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html +// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-index_.html // for details. type IndexService struct { client *Client @@ -172,7 +172,7 @@ func (s *IndexService) buildURL() (string, string, url.Values, error) { }) } else { // Automatic ID generation - // See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html#index-creation + // See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-index_.html#index-creation method = "POST" path, err = uritemplates.Expand("/{index}/{type}/", map[string]string{ "index": s.index, @@ -186,7 +186,7 @@ func (s *IndexService) buildURL() (string, string, url.Values, error) { // Add query string parameters params := url.Values{} if s.pretty { - params.Set("pretty", "1") + params.Set("pretty", "true") } if s.waitForActiveShards != "" { params.Set("wait_for_active_shards", s.waitForActiveShards) @@ -264,7 +264,12 @@ func (s *IndexService) Do(ctx context.Context) (*IndexResponse, error) { } // Get HTTP response - res, err := s.client.PerformRequest(ctx, method, path, params, body) + res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ + Method: method, + Path: path, + Params: params, + Body: body, + }) if err != nil { return nil, err } @@ -279,10 +284,14 @@ func (s *IndexService) Do(ctx context.Context) (*IndexResponse, error) { // IndexResponse is the result of indexing a document in Elasticsearch. type IndexResponse struct { - // TODO _shards { total, failed, successful } - Index string `json:"_index"` - Type string `json:"_type"` - Id string `json:"_id"` - Version int `json:"_version"` - Created bool `json:"created"` + Index string `json:"_index,omitempty"` + Type string `json:"_type,omitempty"` + Id string `json:"_id,omitempty"` + Version int64 `json:"_version,omitempty"` + Result string `json:"result,omitempty"` + Shards *shardsInfo `json:"_shards,omitempty"` + SeqNo int64 `json:"_seq_no,omitempty"` + PrimaryTerm int64 `json:"_primary_term,omitempty"` + Status int `json:"status,omitempty"` + ForcedRefresh bool `json:"forced_refresh,omitempty"` } |