in func BulkIndexer.Add(ctx,BulkIndexerItem) ,format of the BulkIndexerItem.Body parameters is too strict and is not explicitly stated in the documentation #907
type BulkIndexerItem struct {
Body io.ReadSeeker
....
}
The data must be formatted in JSON and should not include any line breaks; otherwise, Elasticsearch will return a 400 error:
[400 Bad Request] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Malformed action/metadata line [3], expected START_OBJECT but found [VALUE_STRING]." .......
This can easily lead to misuse. It is advisable to either highlight this requirement within the body argument of BulkIndexerItem or implement automatic handling of line breaks in the Add(context.Context, BulkIndexerItem) method.
bulk_indexer.go
The data must be formatted in JSON and should not include any line breaks; otherwise, Elasticsearch will return a 400 error:
This can easily lead to misuse. It is advisable to either highlight this requirement within the body argument of BulkIndexerItem or implement automatic handling of line breaks in the Add(context.Context, BulkIndexerItem) method.