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.
Problem
Currently, there is no way to configure an index strategy to map a custom index name by topic and message payload.
To insert a document to a custom index name at the moment, the developer needs to create a specific topic name that corresponds with the Elasticsearch index name
#595
#385
#341
Solution
In this solution, we introduce a new configuration
index.mapper
which gets a classpath as an argument of a custom implementation of the IndexMapper.java interface. thegetIndex()
function in the interface return the custom index name.For backward compatibility reasons, the index name creation logic was transferred to a DefaultIndexMapper.java which will be loaded if no other configuration is specified.
Does this solution apply anywhere else?
If yes, where?
I took inspiration from the MongoDB source connector
https://github.com/mongodb/mongo-kafka/tree/master/src/main/java/com/mongodb/kafka/connect/source
Test Strategy
Unit tests:
Integration tests:
tested manually as well.
Testing done:
Release Plan
This feature is backwards compatible.
Merging to master