Split Index Help Required

I am trying to reindex my index with following commands. And I get an error.
source - transactions-reindexed-2018.12.03-01

PUT t2
{
    "settings": {
        "index.number_of_shards" : 5,
        "index.number_of_routing_shards" : 100 
    }
}


PUT /transactions-reindexed-2018.12.03-01/_settings
{
  "settings": {
    "index.blocks.write": true 
  }
}

POST transactions-reindexed-2018.12.03-01/_split/t2
{
  "settings": {
    "index.number_of_shards": 10
  }
}

Error

 {
      "error": {
        "root_cause": [
          {
            "type": "illegal_state_exception",
            "reason": "the number of routing shards [5] must be a multiple of the target shards [10]"
          }
        ],
        "type": "illegal_state_exception",
        "reason": "the number of routing shards [5] must be a multiple of the target shards [10]"
      },
      "status": 500
    }

Index Info

Health:
green
Status:
open
Primaries:
5
Replicas:
1
Docs Count:
54350414
Docs Deleted:
0
Storage Size:
4gb
Primary Storage Size:
2gb

It looks like you have mixed up the source and destination indices. I believe it should look like this:

PUT t2
{
  "settings": {
    "index.number_of_shards" : 5,
    "index.number_of_routing_shards" : 100
  }
}

PUT /t2/_settings
{
  "settings": {
    "index.blocks.write": true
  }
}

POST t2/_split/transactions-reindexed-2018.12.03-01
{
  "settings": {
    "index.number_of_shards": 10
  }
}

Thanx Christian,
When I ran as you instructed, got following error,

{
  "error": {
    "root_cause": [
      {
        "type": "resource_already_exists_exception",
        "reason": "index [transactions-reindexed-2018.12.03-01/cNqlGSmwTt-pa_LYvkGyeQ] already exists",
        "index_uuid": "cNqlGSmwTt-pa_LYvkGyeQ",
        "index": "transactions-reindexed-2018.12.03-01"
      }
    ],
    "type": "resource_already_exists_exception",
    "reason": "index [transactions-reindexed-2018.12.03-01/cNqlGSmwTt-pa_LYvkGyeQ] already exists",
    "index_uuid": "cNqlGSmwTt-pa_LYvkGyeQ",
    "index": "transactions-reindexed-2018.12.03-01"
  },
  "status": 400
}

I think that error message is quite clear. You can not create the new index as it already exists.

i wanna split my "transactions-reindexed-2018.12.03-01" index with 5 shards to 10 shards.
I don't have an index named t2 till I create using the 1 step of the split command.
What I am doing wrong here?

The index you want to split (t2 in the example) must have been created with index.number_of_routing_shards set. If you are looking to split transactions-reindexed-2018.12.03-01 into a new index named t2 you will need to swap the index names in the example I provided. If the index you want to split was not created with the index.number_of_routing_shards parameter, split will not work and you instead need to reindex.

It looks like this is an hourly index. How much data does it contain as you are considering a split? Keep in mind that having lots of small indices and shards can be very inefficient and affect performance.

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