You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm interested in trying elasticsearch-elixir with Req or Finch for performance reasons. I see there is an ElasticSearch.API behavior for the HTTP client modules, but it looks like the types referenced by the behavior are specific to HTTPoison. Is elasticsearch-elixir designed to be used with other HTTP clients? And if so, can the HTTPoison specific types in the behavior be removed?
Thanks!
The text was updated successfully, but these errors were encountered:
Also running into this when trying to use a MockHTTP module with hammox. The contract is enforced to ensure the Mock returns the same types as what is specified in the behaviour. This means that it is not just about implementing with a different client, but also when using a mock for testing.
I ended up solving this by doing something like this:
defmoduleClientImplementationdo@behaviourElasticsearch.API...@impltruedefrequest(config,method,url,data,opts)do# perform actual request here with whatever client you want...# elasticsearch-library assumes HTTPoison response, so we mimic an HTTPoison# struct here to keep Dialyzer happy{:ok,%{status_code: status,body: body}}endend
Kind of ugly returning a map with certain values but it kept dialyzer happy in our project so that is what we did.
I'm interested in trying elasticsearch-elixir with Req or Finch for performance reasons. I see there is an
ElasticSearch.API
behavior for the HTTP client modules, but it looks like the types referenced by the behavior are specific toHTTPoison
. Is elasticsearch-elixir designed to be used with other HTTP clients? And if so, can theHTTPoison
specific types in the behavior be removed?Thanks!
The text was updated successfully, but these errors were encountered: