Elasticsearch7.5 routing hash function

the Elasticsearch routine description like this

routing_factor = num_routing_shards / num_primary_shards
shard_num = (hash(_routing) % num_routing_shards) / routing_factor

i want to know the hash function so that i cant group ids search to different shard ,
thank you so much !

my query may like this , i want get the top50 similar docs, the ids may be more than 1000


GET my_index03/_search
{
  "_source": {
    "includes": [
      "key"
    ]
  },
  "query": {
    "script_score": {
      "query": {
        "ids": {
          "values": [
            "231156390","89760","876890","12345","56743","123412"
          ]
        }
      },
      "script": {
        "params": {
          "query_vector": [
            0.2811,
            0.1774,
            -0.0762,
            0.0102,
            -0.0449,
            0.1017,
            -0.0161,
            -0.4252,
            0.375,
            0.1886,
            -0.0347,
            0.2719,
            0.2716,
            0.2014,
            -0.1475,
            -0.119,
            0.1738,
            0.3532,
            0.0961,
            -0.2252
          ]
        },
        "source": """
        double value = dotProduct(params.query_vector,doc['vector']);         
        return sigmoid(1, Math.E, -value);
        """
      }
    }
  }
}

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