Get Document without knowing routing value?

I have explicitly routed documents in order to use join fields. Now I notice that the routing value is required even for looking up a specific doc by its ID.

GET my_index/_doc/my_doc_id?routing=3

With the default 5 shards I can request the same doc ID from each shard in an Multi-get Document request but that is not great…

Is there a way to avoid the need to specify routing on Document Get requests for routed docs?

ids query may helps:

GET /_search
{
  "query": {
    "ids" : {
      "values" : ["1", "4", "100"]
    }
  }
}

, routing value is not needed, it uses term query to search documents by the specified document ids.

1 Like

Thanks! This is the best solution so far :+1: