Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed cross cluster searching resolves #692 #693

Merged
merged 3 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions lib/readers/elasticsearch_date_range/slicer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ function newSlicer(context, opConfig, executionContext, retryData, logger, clien

const elasticsearch = require('elasticsearch_api')(client, logger, opConfig);

function checkElasticsearch(esClient) {
if (esClient) {
return elasticsearch.version();
}

return Promise.reject('no client is available for slicer');
}

function processInterval(str, esDates) {
if (!moment(new Date(str)).isValid()) {
// one or more digits, followed by one or more letters, case-insensitive
Expand Down Expand Up @@ -115,7 +107,8 @@ function newSlicer(context, opConfig, executionContext, retryData, logger, clien
.then((results) => {
const data = _.get(results, 'hits.hits[0]._source', results[0]);
if (data === undefined) {
return moment();
logger.warn(`no data was found using query ${JSON.stringify(query)} for index: ${opConfig.index}`);
return null;
}

if (data[opConfig.date_field_name] === undefined) {
Expand Down Expand Up @@ -507,7 +500,7 @@ function newSlicer(context, opConfig, executionContext, retryData, logger, clien
return Promise.resolve(slicers);
}

return checkElasticsearch(client)
return elasticsearch.version()
.then(() => getDates()
.then((esDates) => {
// query with no results
Expand Down
6 changes: 3 additions & 3 deletions spec/readers/elasticsearch_reader-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ describe('elasticsearch_reader', () => {
Promise.resolve(slicer())
.then((results) => {
expect(results).toEqual(null);
done();
})
.catch((error) => {
fail(error);
done();
});
});
})
.catch(fail)
.finally(done);
});

it('slicer can produce date slices', (done) => {
Expand Down