Skip to content

Instantly share code, notes, and snippets.

@whalesalad
Created January 8, 2019 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whalesalad/b6fa65236e93265c9dbdf5b2109ec757 to your computer and use it in GitHub Desktop.
Save whalesalad/b6fa65236e93265c9dbdf5b2109ec757 to your computer and use it in GitHub Desktop.
{
"query": "<%= params[:query] %>",
"suggestions": [
<% size = @customers.size %>
<% @customers.each_with_index do |customer, i| %>
{
"value": "<%= customer.id %>",
"data": <%= raw customer._source.to_json %>
}<%= i + 1 == size ? "" : "," %>
<% end %>
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment