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 batch indexing #21

Merged
merged 6 commits into from
Nov 22, 2023
Merged

Add batch indexing #21

merged 6 commits into from
Nov 22, 2023

Conversation

ronitagarwala01
Copy link
Contributor

Helps reduce single request load and avoids timeout errors from JS client

@ronitagarwala01
Copy link
Contributor Author

Just wanted to add another comment about batch size. It MUST be even. Because of how client.bulk() works, each entry in the data array is mapped to two consecutive objects: One that has the index and id to store the data entry at, and the second that has the actual data. Using an odd batch size would separate these into different batches likely causing it to not work properly.

@ronitagarwala01 ronitagarwala01 force-pushed the batchIndex branch 2 times, most recently from ad2ac94 to 6ea6661 Compare November 22, 2023 06:03
ronitagarwala01 and others added 5 commits November 22, 2023 01:06
Helps reduce single request load and avoids timeout errors from JS client
-Switch to Array.forEach method for faster indexing
-Use lodash chunk method for batching
Import only chunk from lodash

Co-authored-by: Leo Singer <leo.p.singer@nasa.gov>
@lpsinger lpsinger merged commit ca49c34 into nasa-gcn:main Nov 22, 2023
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.

2 participants