Update without index

Is it possible to update a document without knowing it's index?
I have the document id and it's unique between all indexes.

May be update by query API but it's less efficient than knowing the coordinates.

I wrote this:

        UpdateByQueryRequestBuilder builder = UpdateByQueryAction.INSTANCE.newRequestBuilder(client());
        builder.script(new Script("ctx._source" + EventsConstants.REMAINING_TRIGGERS_STRING + "=" + event.getRemainingTriggersString()));
        builder.source().setQuery(QueryBuilders.termQuery(EventsConstants.ID, event.getId().toString()));

        if (builder.get() != null) {

and got failed to find action [org.elasticsearch.index.reindex.UpdateByQueryAction@5d096ed] to execute.

Can you please tell me what is wrong?


Why not simply first search for the document in order to get the index and then use that to perform the update? Invoking update-by-query for a single document seems like overkill...

Thought about that also.Didn't know what is better performance wise. Will search before the update. Thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.