This repository was archived by the owner on Aug 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 506
METRON-1849 Elasticsearch Index Write Functionality Should be Shared #1254
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nsformer Shade plugin transformer.
…ate properties for new client.
This reverts commit 7d9ee25.
…h, and kerberos/security documentation
823d739 to
21089a0
Compare
9a7eb7b to
5b6c6b0
Compare
12 tasks
mmiklavc
reviewed
Nov 27, 2018
...arch/src/main/java/org/apache/metron/elasticsearch/bulk/ElasticsearchBulkDocumentWriter.java
Outdated
Show resolved
Hide resolved
mmiklavc
reviewed
Nov 27, 2018
...-elasticsearch/src/main/java/org/apache/metron/elasticsearch/writer/ElasticsearchWriter.java
Outdated
Show resolved
Hide resolved
…ring to maintain backwards compatibility
mmiklavc
reviewed
Dec 4, 2018
...ron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/bulk/BulkDocumentWriter.java
Outdated
Show resolved
Hide resolved
...n-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/update/Document.java
Outdated
Show resolved
Hide resolved
...-elasticsearch/src/main/java/org/apache/metron/elasticsearch/writer/ElasticsearchWriter.java
Outdated
Show resolved
Hide resolved
...sticsearch/src/test/java/org/apache/metron/elasticsearch/writer/ElasticsearchWriterTest.java
Outdated
Show resolved
Hide resolved
...metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
Show resolved
Hide resolved
justinleet
reviewed
Dec 10, 2018
...-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchUpdateDao.java
Show resolved
Hide resolved
...sticsearch/src/main/java/org/apache/metron/elasticsearch/bulk/BulkDocumentWriterResults.java
Outdated
Show resolved
Hide resolved
...ron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/bulk/BulkDocumentWriter.java
Outdated
Show resolved
Hide resolved
...arch/src/main/java/org/apache/metron/elasticsearch/bulk/ElasticsearchBulkDocumentWriter.java
Outdated
Show resolved
Hide resolved
...arch/src/main/java/org/apache/metron/elasticsearch/bulk/ElasticsearchBulkDocumentWriter.java
Outdated
Show resolved
Hide resolved
...asticsearch/src/test/java/org/apache/metron/elasticsearch/writer/BulkDocumentWriterStub.java
Outdated
Show resolved
Hide resolved
Contributor
|
+1, pending Travis and @mmiklavc. Thanks a lot, it's great to see this cleaned up and refactored! |
Contributor
|
+1 lgtm with the latest changes, thanks for the submission @nickwallen! |
Contributor
Author
|
Thanks for the feedback @justinleet and @mmiklavc . It turned out better for it. I will merge once the latest CI build completes. |
JonZeolla
pushed a commit
to JonZeolla/metron
that referenced
this pull request
Jan 24, 2019
…(nickwallen) closes apache#1254
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Elasticsearch index write functionality is currently duplicated between the
ElasticsearchWriterand theElasticsearchUpdateDao. This functionality needs to be de-duplicated and shared between the two. This will help ensure that any changes that need to be made to how alerts are written, for instance whether the client sets a document ID, are implemented and tested in the same way across Metron.This change depends on the following PRs. Once these predecessors are addressed, review of this will be much simpler.
Changes
Created the
BulkDocumentWriterandElasticsearchBulkDocumentWriterthat are responsible for writing messages/alerts/documents to an Elasticsearch index.The
ElasticsearchWriteruses aBulkDocumentWriter<TupleBasedDocument>to index messages in Elasticsearch.The
ElasticsearchWriteractually writesTupleBasedDocumentPOJOS that extendDocument. This allows it to maintain the relationship between a tuple and the document created from a tuple. If aDocumentfails to write, we need to fail the associated tuple.The scope of the
ElasticsearchWritertests were increased since this was now easier with the new abstractions.The
ElasticsearchUpdateDaouses aBulkDocumentWriter<Document>to update alerts for the Alerts UI.The
ElasticsearchRetrieveLatestDaowas setting the timestamp of allDocuments returned to 0. This was causing the tests that I added to fail. I added logic to extract the timestamp from the message and set theDocument.timestampif one exists.Instead of creating the
BulkDocumentWriterabstraction, I also looked at a couple alternatives.Another approach I looked at was to simply have the
ElasticsearchWriteruse anElasticsearchUpdateDao. Unfortunately, this quickly led to a large number of changes. TheElasticsearchUpdateDaodoes not track and record individual failures in a batch. It instead fails fast if any single update in a batch fails. To track individual failures, as needed by theElasticsearchWriter, would have required changes to the signature ofUpdateDao.Another approach was to have the
ElasticsearchUpdateDaouse anElasticsearchWriter. Unfortunately, theElasticsearchWriteris aBulkMessageWriterand requires Storm as a dependency due to its use ofTopologyContext. To clean this up would have required a large number of changes.Testing
Spin-up the Full Dev environment. Use the Alerts UI to:
Pull Request Checklist