ESx v0.7.2 ESx.Model.Base
Sets up esx that make it easy to configure and ecto adapters.
Example
# In your mix.esx file
def application do
[applications: [:esx]]
end
# In your config/config.exs file
config :esx, ESx.Model,
url: "http://example.com:9200",
repo: MyApp.Repo # defines Ecto for connecting database.
Multiple configuration
This is configuration that if you’ve have multiple Elasticsearch’s Endpoint which’s another one.
First, that configuration is defined with ESx.Model.Base
into your project. It’s like Ecto’s Repo.
Example
# In your lib/my_app/esx.ex file
defmodule MyApp.ESx do
use ESx.Model.Base, app: :my_app
end
# And so that there's `MyApp.ESx` configuration for Mix.config below.
# In your config/config.exs file
config :my_app, MyApp.ESx,
scheme: "http",
host: "example.com",
port: 9200