       analyses = @es_analyses |> Enum.reverse
 
       Module.eval_quoted __ENV__, [
-        Analysis.__es_analyses__(analyses),
+        Analysis.__es_analyses__(analyses, unquote(options)),
       ]
     end
   end

  @doc false
  defmacro __using__(_) do
    quote do
      import Analysis, only: [analysis: 1]

      Module.register_attribute(__MODULE__, :es_analyses, accumulate: true)
    end
  end

  defmacro analysis([do: block]) do
    es_analysis(__MODULE__, block)
  end

  @doc false
  def es_analysis(_mod, block) do
    quote do
      # mod = unquote(mod)


  end

  @doc false
  def __es_analyses__(analyses, options) do
    types =
      Enum.reduce analyses, [], fn {type, name, opts}, acc ->
        m = Keyword.new([{name, opts}])
