-
Notifications
You must be signed in to change notification settings - Fork 207
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
Migrated Data Prepper to use the opensearch-java client for bulk requests #1381
Migrated Data Prepper to use the opensearch-java client for bulk requests #1381
Conversation
…ests rather than the REST High Level Client. opensearch-project#1347 Signed-off-by: David Venable <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1381 +/- ##
=========================================
Coverage 94.08% 94.08%
Complexity 1156 1156
=========================================
Files 162 162
Lines 3248 3248
Branches 263 263
=========================================
Hits 3056 3056
Misses 138 138
Partials 54 54 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
JsonProvider jsonProvider = jsonpMapper.jsonProvider(); | ||
final JsonData jsonData = JsonData.from(jsonProvider.createParser(new StringReader(jsonString)), jsonpMapper); | ||
|
||
final String serializedJsonLength = jsonData.toJson().toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Variable name should be serializedJson
or should have length()
method in this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.micrometer.core.instrument.Measurement; | ||
import org.apache.commons.io.FileUtils; | ||
import org.apache.http.util.EntityUtils; | ||
import org.hamcrest.MatcherAssert; | ||
import org.junit.After; | ||
import org.junit.Assert; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since now we are using JUnit 5, this could be replaced. Could be in follow up PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. This change is already significant, and so I wanted to minimize the number of unnecessary changes. I noticed this when doing it, but didn't want to add even more change.
Description
This PR updates Data Prepper to use the opensearch-java client for _bulk requests to OpenSearch. It does not update all interactions to the opensearch-java client. Others can come in subsequent PRs.
With this change, Data Prepper also runs against OpenSearch 2.0.0-rc1.
Related changes included in this PR include:
Record<String>
andRecord<Event>
models. Previously these tests only ran againstRecord<Sink>
.Issues Resolved
Resolves #1347
Check List
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.