     escaped = Macro.escape(types)
 
     quote do
-      def __es_analysis__(:to_map), do: %{analysis: Funcs.to_map(unquote(escaped))}
+      def __es_analysis__(:to_map) do
+        analysis = %{analysis: Funcs.to_map(unquote(escaped))}
+        Map.merge Funcs.to_map(unquote(options)), analysis
+      end
       def __es_analysis__(:as_json), do: __es_analysis__ :to_map
       def __es_analysis__(:types), do: unquote(escaped)
       unquote(quoted)
       def __es_analysis__(:type, _), do: nil
+
+      def __es_analysis__(:settings), do: unquote(options)
     end
   end
 

  end

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

      analyses = @es_analyses |> Enum.reverse

      Module.eval_quoted __ENV__, [
        Analysis.__es_analyses__(analyses, unquote(options)),
      ]
    end
  end
