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

Add import helper function to optimize data uploading time #43

Merged
merged 4 commits into from
Oct 4, 2023

Conversation

abbyhu2000
Copy link
Member

Description

Add a function to read docs from a file and import them to OpenSearch only when the indices do not already exist in order to optimize the data uploading time in cypress tests.

Issues Resolved

resolves opensearch-project/opensearch-dashboards-functional-test#903

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Qingyang(Abby) Hu <[email protected]>
Signed-off-by: Qingyang(Abby) Hu <[email protected]>
Comment on lines 100 to 107
let queryString = '';
if (typeof index === 'string') {
queryString = index;
} else if (Array.isArray(index)) {
index.forEach(value => queryString += `${value},`);
} else {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let queryString = '';
if (typeof index === 'string') {
queryString = index;
} else if (Array.isArray(index)) {
index.forEach(value => queryString += `${value},`);
} else {
return;
}
const queryString = (Array.isArray(index) ? index : [index]).join(',');

Copy link
Contributor

Choose a reason for hiding this comment

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

const items = (Array.isArray(index) ? index : [index]);
if (items.some(value => typeof value !== 'string')) return;
const queryString = items.join(',');

Signed-off-by: Qingyang(Abby) Hu <[email protected]>
@ashwin-pc ashwin-pc merged commit 200bc9d into opensearch-project:main Oct 4, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add helper function to optimize sample data uploading time
5 participants