Skip to content

Instantly share code, notes, and snippets.

@aercolino
Last active December 4, 2018 19:33
Show Gist options
  • Select an option

  • Save aercolino/05a003b14fd4cc456c64 to your computer and use it in GitHub Desktop.

Select an option

Save aercolino/05a003b14fd4cc456c64 to your computer and use it in GitHub Desktop.
Searching into ElasticSearch with jQuery
// the important bit it JSON.stringify, because elasticsearch doesn't work without it
jQuery.post('http://elasticsearch.example.com:9200/activity/_search/', JSON.stringify({
"query": {
"term": {
"activity.id": "1234"
}
}
}), function (data) {
result.sessions = data.hits && data.hits.hits.length && data.hits.hits[0]._source && data.hits.hits[0]._source.sessions || [];
}, 'json');
@Alfalchion

Copy link
Copy Markdown

How can you add the security keys in case the site has Authentication?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment