Hi All,
I am trying to use custom routing to index some document to a particular shard. Below is the link I referred,
https://www.elastic.co/guide/en/elasticsearch/guide/current/routing-value.html#routing-value
Sample doc:-
POST es_item/item/3214440?routing=50
{
"ITEM_ID": 3214440,
"ITEM_CODE": "9588049",
"ITEM_DSCR": "HOME FURNISHINGS & DECOR",
"ITEM_SPECIFICITY_REF_ID": 186,
"ITEM_TYPE": "SGI",
"RELATIONSHIP": [
{
"REL_TYP_REF_ID": -999,
"REL_TYPE": "NO RELATIONSHIP",
"REL_CTGRY": "NIL"
}
],
"ITEM_MISUSED_GTIN_FLG": "N",
"CRT_DTTM": "2004-09-25 22:00:00",
"UPD_DTTM": "2014-06-01 04:01:30",
"DIST": [
{
"RGN_ID": 5,
"RGN_NM": "AT",
"DSTN_STRT_DT": "2011-03-03 21:33:51",
"DSTN_END_DT": "9999-12-31 00:00:00",
"ITEM_GLBL_CODE_ST_REF_ID": 721,
"PRE_MOVEMENT_DT": null
}
],
"ICV": {
"C37": 18136791
},
"XCD": []
}
I am setting a custom routing value as "50" while indexing when I search the document it was indexed in shard 6
By Using this formula I am not able to find the shard number,
shard = hash(routing) % number_of_primary_shards
number of primary shards value: - 18
routing=10
Can any one help me how to find the shard number using the formula?
(or)
Is the right way to do custom routing in elasticsearch?
Please let us know your suggestions.
Thanks,
Ganeshbabu R