Skip to content

Setting a routing parameter for OpenSearch request #300

@kaitoyamagishi1109

Description

@kaitoyamagishi1109

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions