From 4bd91806232234193030ec2626a2a479e9bdad5f Mon Sep 17 00:00:00 2001 From: Nitin Misra Date: Thu, 20 Dec 2018 18:53:40 +0530 Subject: [PATCH] Fix :default_options config name --- README.md | 13 ++++++++++++- lib/elasticsearch/api/http.ex | 2 +- lib/elasticsearch/cluster/cluster.ex | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 947f8d8..f5e1e5b 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,17 @@ config :my_app, MyApp.ElasticsearchCluster, } ``` +#### Specifying HTTPoison Options + +``` +config :my_app, MyApp.ElasticsearchCluster, + default_options: [ + timeout: 5_000, + recv_timeout: 5_000, + hackney: [pool: :pool_name] + ] +``` + ## Protocols and Behaviours #### Elasticsearch.Store @@ -120,7 +131,7 @@ defmodule MyApp.ElasticsearchStore do @behaviour Elasticsearch.Store import Ecto.Query - + alias MyApp.Repo @impl true diff --git a/lib/elasticsearch/api/http.ex b/lib/elasticsearch/api/http.ex index ba8454d..a064a1a 100644 --- a/lib/elasticsearch/api/http.ex +++ b/lib/elasticsearch/api/http.ex @@ -12,7 +12,7 @@ defmodule Elasticsearch.API.HTTP do process_url(url, config), process_request_body(data, config), headers(config), - opts ++ Map.get(config, :default_opts, []) + opts ++ Map.get(config, :default_options, []) ) |> process_response(config) end diff --git a/lib/elasticsearch/cluster/cluster.ex b/lib/elasticsearch/cluster/cluster.ex index 28f4326..128a541 100644 --- a/lib/elasticsearch/cluster/cluster.ex +++ b/lib/elasticsearch/cluster/cluster.ex @@ -98,7 +98,7 @@ defmodule Elasticsearch.Cluster do username: "username", password: "password", default_headers: [{"authorization", "custom-value"}], - default_opts: [ssl: [{:versions, [:'tlsv1.2']}], + default_options: [ssl: [{:versions, [:'tlsv1.2']}], indexes: %{ posts: %{ settings: "priv/elasticsearch/posts.json",