StoreStats storeStats = mock(StoreStats.class);
when(indexShard.storeStats()).thenReturn(storeStats);
when(storeStats.getSizeInBytes()).thenReturn(123456L);
DocsStats docsStats = mock(DocsStats.class);
when(indexShard.docStats()).thenReturn(docsStats).thenThrow(IllegalIndexShardStateException.class);
when(docsStats.getCount()).thenReturn(654321L);
ShardRouting shardRouting = mock(ShardRouting.class);
when(indexShard.routingEntry()).thenReturn(shardRouting);
when(shardRouting.primary()).thenReturn(true);
when(shardRouting.relocatingNodeId()).thenReturn("node_X");