Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7 from gsf/readme-update

Readme update
  • Loading branch information...
commit 3c2b0c1e41c8a4c6723388df6fd923d6e5552130 2 parents 7d60ab1 + d7a9085
@ncb000gt authored
Showing with 26 additions and 28 deletions.
  1. +25 −27 README.md
  2. +1 −1  lib/elasticsearch.js
View
52 README.md
@@ -1,48 +1,46 @@
node-elasticsearch
-============
+==================
-This is a module around the REST API for [Elastic Search](http://www.elasticsearch.org/) built for NodeJS.
+This is a Node.js module for the [elasticsearch](http://www.elasticsearch.org/) REST API.
-Details
-=============
+Usage
+=====
-This works with node 0.4.x and with 0.2.x. I needed it for both and so wrote an [http compatability layer](http://github.com/ncb000gt/node-http_compat).
+```js
+var elasticsearch = require('elasticsearch');
+var es = elasticsearch({index: 'kitteh'});
+es.query({query: {field: {field1: 'hai'}}}, function(err, results) {
+ console.log(results);
+});
+```
-Usage
-=============
- var lib = require('elasticsearch'), sys = require('sys'); //replace sys with util if you're on node 0.4.x
- lib.createClient(function(client) {
- client.query({query: {field: {field1: 'hai'}}}, function(err, results) {
- console.log(sys.inspect(results, true, 10));
- });
- });
+API
+===
+TBD
-API
-==============
-*Will go here when I'm ready to post it.*
+Testing
+=======
+
+```
+npm install
+npm test
+```
Requirements
-=============
+============
-* NodeJS
-* Elastic Search
-* nodeunit (for testing)
+* Node.js
+* elasticsearch
* The need for search
License
-=============
+=======
MIT
-
-
-Trademarks?
-============
-
-Node.js™ is an official trademark of Joyent. This module is not formally related to or endorsed by the official Joyent Node.js open source or commercial project
View
2  lib/elasticsearch.js
@@ -2,7 +2,7 @@ var utils = require('./utils'),
Index = require('./index');
function ElasticSearch(args) {
- var opts = args[0],
+ var opts = args[0] || {},
cb = ((args.length>1)?args[1]:undefined);
if (!(opts.index)) {
throw new Error('Must specify an index for ES.');
Please sign in to comment.
Something went wrong with that request. Please try again.