rode / grafeas-elasticsearch

An implementation of the Grafeas storage backend based on Elasticsearch
Apache License 2.0
12 stars 5 forks source link

Omit empty on bulk query fragment types #71

Closed alexashley closed 3 years ago

alexashley commented 3 years ago

Without omitempty, the index field is populated during a bulk create:

{"index":null,"create":{"_id":"foo"}}
{"name":"foo"}

which causes an error to be returned from Elasticsearch:

[400 Bad Request] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Malformed action/metadata line [1], expected START_OBJECT or END_OBJECT but found [VALUE_NULL]"}],"type":"illegal_argument_exception","reason":"Malformed action/metadata line [1], expected START_OBJECT or END_OBJECT but found [VALUE_NULL]"},"status":400}

Also renamed EsSortOrderDecending -> EsSortOrderDescending and removed some duplicate assertions.