{
  "id": "repartition",
  "title": "Repartition",
  "url": "https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/gears-v1/jvm/classes/gearsbuilder/repartition/",
  "summary": "Moves records between shards according to the extracted data.",
  "tags": [
    "docs",
    "operate",
    "stack"
  ],
  "last_updated": "2026-04-22T11:55:45+02:00",
  "page_type": "content",
  "content_hash": "5ca7cc005f4096b97fdf12938ee7b14c16338efa95f035436605fd5fa15742d4",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "[code example]\n\nMoves records between the shards. The extracted data determines the new shard location for each record."
    },
    {
      "id": "parameters",
      "title": "Parameters",
      "role": "parameters",
      "text": "| Name | Type | Description |\n|------|------|-------------|\n| extractor | <nobr>ExtractorOperation<T></nobr> | Extracts a specific value from each record |"
    },
    {
      "id": "returns",
      "title": "Returns",
      "role": "returns",
      "text": "Returns a GearsBuilder object with a new template type."
    },
    {
      "id": "example",
      "title": "Example",
      "role": "example",
      "text": "Repartition by value:\n\n[code example]"
    }
  ],
  "examples": [
    {
      "id": "overview-ex0",
      "language": "java",
      "code": "public GearsBuilder<T> repartition​(\n\tgears.operations.ExtractorOperation<T> extractor)",
      "section_id": "overview"
    },
    {
      "id": "example-ex0",
      "language": "java",
      "code": "GearsBuilder.CreateGearsBuilder(reader).\n   \trepartition(r->{\n   \t\treturn r.getStringVal();\n});",
      "section_id": "example"
    }
  ]
}
