Skip to content

Commit

Permalink
opensearchutil: add missing bulk indexer response item fields
Browse files Browse the repository at this point in the history
If a bulk request contains any script error, Opensearch server points
what is wrong with the request. This information is valuable to those
debugging what is wrong with the scripted request.

Signed-off-by: İbrahim Güngör <[email protected]>
  • Loading branch information
igungor authored and VijayanB committed Feb 11, 2022
1 parent 3da5909 commit 56d95cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ This project is licensed under the [Apache v2.0 License](LICENSE.txt).

## Copyright

Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
18 changes: 15 additions & 3 deletions opensearchutil/bulk_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,21 @@ type BulkIndexerResponseItem struct {
Type string `json:"type"`
Reason string `json:"reason"`
Cause struct {
Type string `json:"type"`
Reason string `json:"reason"`
} `json:"caused_by"`
Type string `json:"type"`
Reason string `json:"reason"`
ScriptStack *[]string `json:"script_stack,omitempty"`
Script *string `json:"script,omitempty"`
Lang *string `json:"lang,omitempty"`
Position *struct {
Offset int `json:"offset"`
Start int `json:"start"`
End int `json:"end"`
} `json:"position,omitempty"`
Cause *struct {
Type string `json:"type"`
Reason string `json:"reason"`
} `json:"caused_by"`
} `json:"caused_by,omitempty"`
} `json:"error,omitempty"`
}

Expand Down

0 comments on commit 56d95cc

Please sign in to comment.