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

Setting a routing parameter for OpenSearch request #300

Open
kaitoyamagishi1109 opened this issue Jul 8, 2024 · 1 comment
Open

Setting a routing parameter for OpenSearch request #300

kaitoyamagishi1109 opened this issue Jul 8, 2024 · 1 comment

Comments

@kaitoyamagishi1109
Copy link

Is it possible to upsert a document with a particular routing parameter?
I have tried to manipulate the key to append ?_routing=${route} as a suffix, but it doesn't seem to work.

As far as the code goes, in RequestBuilder.java,

if (config.indexWriteMethod() == IndexWriteMethod.UPSERT) {
                return new UpdateRequest().id(documentId)
                        .index(index)
                        .doc(payload, XContentType.JSON)
                        .upsert(payload, XContentType.JSON)
                        .docAsUpsert(true)
                        .retryOnConflict(Math.min(config.maxInFlightRequests(), 3));

This is what I understand is making the API request to OpenSearch.
Looking at the reference for this API, I find that there is an optional .routing() parameter.
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-document-update.html#_optional_arguments_3

From these information, I am assuming that setting the routing parameter is impossible as of now. If someone has been able to achieve this with the current state of this plugin, any help will be greatly appreciated. Happy Coding!

@kaitoyamagishi1109
Copy link
Author

Came across an issue/PR on the confluent brother of this plugin.
confluentinc/kafka-connect-elasticsearch#558
confluentinc/kafka-connect-elasticsearch#223

Looks like the PR has been on hold since 2021; seems like the mods haven't provided a valid reason not to include these changes to the project. The solution I was thinking of is very close to this PR.

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

No branches or pull requests

1 participant