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
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion lib/readers/elasticsearch_date_range/slicer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ function newSlicer(context, opConfig, executionContext, retryData, logger, clien

function checkElasticsearch(esClient) {
if (esClient) {
// regex searches for zero or more chars preceding a '*' , zero or more chars after
// before a ':' then any amount of chars before and after another '*'
// => ie es_d*:2017-domains*
const wildCardRegex = RegExp(/\*/g);
const isWildCardRegexSearch = opConfig.index.match(wildCardRegex);
// We cannot reliable search
if (isWildCardRegexSearch !== null) {
logger.warn(`Running a regex or cross cluster search for ${opConfig.index}, there is no reliable way to verify index and max_result_window`);
return Promise.resolve(true);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be in elasticsearch_api with the rest of the logic related to index validation?

return elasticsearch.version();
}

Expand Down Expand Up @@ -115,7 +125,7 @@ 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();
return Promise.reject(`could not parse date ranges for index: ${opConfig.index}, please verify either the date_field_name or the connection specified on the job`);
}

if (data[opConfig.date_field_name] === undefined) {
Expand Down