Created
August 5, 2011 02:26
-
-
Save phillro/1126806 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var serverOptions = { | |
| host: 'www.elasticsearchhq.com', | |
| port: 9200, | |
| secure: true, | |
| auth: { | |
| username:'[USERNAME]', | |
| password:'[PASSWORD]' | |
| } | |
| }; | |
| var elasticSearchClient = new ElasticSearchClient(serverOptions); | |
| var qryObj = { | |
| field : term | |
| } | |
| elasticSearchClient.search('my_index_name', 'my_type_name', qryObj) | |
| .on('data', function(data) { | |
| console.log(JSON.parse(data)) | |
| }) | |
| .on('done', function(){ | |
| //always returns 0 right now | |
| }) | |
| .on('error', function(error){ | |
| console.log(error) | |
| }) | |
| .exec() | |
| elasticSearchClient.index('my_index_name', 'my_type_name', {'name':'name', id:"1111"}) | |
| .on('data', function(data) { | |
| console.log(data) | |
| }) | |
| .exec() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment