I wonder if there is any internal API I can use to query against a local shard. My code might be a plugin with a query and the id of a local shard on the node. I want to execute the query on the specified shard internally to get results, preferably without http, routing if I don't have to.
What client are you using?
I am writing a plugin so I can use any client that is available to me. The most obvious one would be
I am writing this plugin in Java.
I don't know the details of the clients themselves, but given you're interacting over HTTP for most of them these days you will need to either figure out which node holds the shard you want to query, or just let Elasticsearch figure it out for you and deal with any redirects.
I am not sure why routing is problematic though?
Since I am only interested in the local shards on the node, I have the shard ids and the local node id. Given I only want to run the query on the local shards so extra routing seems unnecessary. That is why I want to know if there is an internal shortcut.
Just use the
_only_local preference parameter - https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-preference.html
I dunno if there's something in the java client for that though sorry.
That would help! Thank you so much!
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.