Calling elasticsearch() without an index would mean querying across all indexes, and anything requiring an index would result in an error.
Indexes can be specified at client creation elasticsearch({index: 'test'}) or in the opts of certain calls es.add({index: 'test'},...).
Maybe try putting an _indices array on the client instance to manage the affected indices for any operation (only one for certain operations like add). Then, a call like es.index('hex') would set _indices to ['hex'] and create the "hex" index if it doesn't exist. This also means es.index doesn't need its own constructor -- it's just a method on the client instance with attached sub-methods.
Move es.query() to es.search() -- with deprecation? And passed parameters should be (opts, req, cb).
##Steps
- Document current API
- Get "elasticsearch" npm namespace
- Propose API changes
- es.query -> es.search
- es.index, es.cluster, es.mapping, etc. as methods with sub-methods
- Convert all code from 4-space to 2-space indent
- Update tests with tape because it's maintained and could allow browser testing