When a document is submitted to Elasticsearch and it doesn't match the relevant mapping, there appear to be some inconsistencies with how the errors are handled in elastisch's native vs REST APIs. The native API throws an exception on document `put` and `create` (ns:
clojurewerkz.elastisch.native.document). However, the REST API will only throw an exception on document `create` but doesn't throw an exception on `put` (ns:
clojurewerkz.elastisch.rest.document). Instead of throwing an exception on `put`, it returns a map with `:status` and `:error` keys.
To make the usage of the native and rest document actions more consistent, I tried setting the `:throw-exceptions` option in the connection config opts to make the REST `put` also throw exceptions, but it doesn't appear to work. It looks like the `:throw-exceptions` option isn't able to be overridden by connection config opts.
I think if the opts are merged last rather than the defaults, then we would be able to get our desired result, which is throwing exceptions upon `put` and `create` errors (just like the native API). Does that make sense?
Thanks,
Steve