make index the first param
This commit is contained in:
@@ -3,12 +3,13 @@ import createClient from './helpers/create_client';
|
|||||||
import { omit } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
|
|
||||||
export default class Elastique extends events.EventEmitter {
|
export default class Elastique extends events.EventEmitter {
|
||||||
constructor(options = {}) {
|
constructor(index, options = {}) {
|
||||||
if (!options.index) throw new Error('Must specify an index to write to');
|
if (!index) throw new Error('Must specify an index to write to');
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
|
this.index = index;
|
||||||
this.settings = Object.assign({
|
this.settings = Object.assign({
|
||||||
interval: '1w',
|
interval: '1w',
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ describe('Elastique class', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw with an invalid host', function () {
|
it('should throw with an invalid host', function () {
|
||||||
const init = () => new Elastique({
|
const init = () => new Elastique('elastique', {
|
||||||
index: 'elastique',
|
|
||||||
client: { host: 'nope://nope' }
|
client: { host: 'nope://nope' }
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -18,8 +17,7 @@ describe('Elastique class', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw with invalid hosts', function () {
|
it('should throw with invalid hosts', function () {
|
||||||
const init = () => new Elastique({
|
const init = () => new Elastique('elastique', {
|
||||||
index: 'elastique',
|
|
||||||
client: { hosts: [{ host: 'localhost', protocol: 'nope' }] }
|
client: { hosts: [{ host: 'localhost', protocol: 'nope' }] }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user