Last active
December 4, 2018 19:33
-
-
Save aercolino/05a003b14fd4cc456c64 to your computer and use it in GitHub Desktop.
Searching into ElasticSearch with jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can you add the security keys in case the site has Authentication?