Skip to content

Instantly share code, notes, and snippets.

@radzserg
Last active February 1, 2017 16:10
Show Gist options
  • Select an option

  • Save radzserg/1053e1a85b6f1a35adf53b97eaf1e4a2 to your computer and use it in GitHub Desktop.

Select an option

Save radzserg/1053e1a85b6f1a35adf53b97eaf1e4a2 to your computer and use it in GitHub Desktop.
defmodule App.Es.EsQueryDsl do
defstruct query: [], _source: %{include: ["id"]}
def get_param(map, key) do
val = Map.get(map, key)
val = if val != "", do: val, else: nil
if is_list(val) && length(val) == 0, do: nil, else: val
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment