> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Collections in Milvus Jobs

export const schema = {
  "type": "object",
  "title": "Create Collections in Milvus",
  "description": "Creates vector collections in Milvus with the specified dimension, metric, and file size parameters. Configure each collection in the `collections-list` array with its name, vector dimension, and similarity metric. Run this job before inserting vectors to ensure the target collections exist with the correct schema.",
  "required": ["id", "type"],
  "properties": {
    "id": {
      "type": "string",
      "title": "Job ID",
      "description": "Sets the unique identifier for this job, used to reference it in the API. Allowed characters: a-z, A-Z, dash (`-`), and underscore (`_`). Must start with a letter.",
      "maxLength": 63,
      "pattern": "[a-zA-Z][_\\-a-zA-Z0-9]*[a-zA-Z0-9]?"
    },
    "sparkConfig": {
      "type": "array",
      "title": "Additional parameters",
      "description": "Injects additional key-value pairs into the training JSON map at runtime. String values must be wrapped in quotes. Use this to pass custom parameters not exposed in the UI.",
      "hints": ["advanced"],
      "items": {
        "type": "object",
        "required": ["key"],
        "properties": {
          "key": {
            "type": "string",
            "title": "Parameter Name"
          },
          "value": {
            "type": "string",
            "title": "Parameter Value"
          }
        }
      }
    },
    "writeOptions": {
      "type": "array",
      "title": "Write Options",
      "description": "Sets additional key-value options passed to the Spark writer when writing output to Solr or other sinks. Use entries like `commitWithin=10000` to control Solr commit behavior.",
      "hints": ["advanced"],
      "items": {
        "type": "object",
        "required": ["key"],
        "properties": {
          "key": {
            "type": "string",
            "title": "Parameter Name"
          },
          "value": {
            "type": "string",
            "title": "Parameter Value"
          }
        }
      }
    },
    "readOptions": {
      "type": "array",
      "title": "Read Options",
      "description": "Sets additional key-value options passed to the Spark reader when loading input from Solr or other sources. Use these to configure connector-specific behavior.",
      "hints": ["advanced"],
      "items": {
        "type": "object",
        "required": ["key"],
        "properties": {
          "key": {
            "type": "string",
            "title": "Parameter Name"
          },
          "value": {
            "type": "string",
            "title": "Parameter Value"
          }
        }
      }
    },
    "collections-list": {
      "type": "array",
      "title": "Collections",
      "description": "Defines the list of Milvus collections to create, each with its name, vector dimension, index file size, and similarity metric. Each entry must specify all required fields. Omitting required fields causes collection creation to fail.",
      "items": {
        "type": "object",
        "required": ["milvusCollectionName", "dimension", "indexFileSize", "metric"],
        "properties": {
          "milvusCollectionName": {
            "type": "string",
            "title": "Collection Name",
            "description": "Specifies the name of the Milvus collection to create. Must contain only alphanumeric characters and underscores. This name is used to reference the collection in subsequent index and data operations.",
            "pattern": "^[a-zA-Z0-9_]+$"
          },
          "dimension": {
            "type": "integer",
            "title": "Dimension",
            "description": "Sets the vector dimension size for all vectors stored in this Milvus collection. This must match the output dimension of the embedding model used to generate vectors. Mismatches cause insert errors."
          },
          "indexFileSize": {
            "type": "integer",
            "title": "Index File Size",
            "description": "Sets the file size threshold (in MB) that triggers index building for raw data segments. Files larger than this value are automatically indexed. The default value of `1024` works for most use cases.",
            "default": 1024,
            "minimum": 1,
            "exclusiveMinimum": false
          },
          "metric": {
            "type": "string",
            "title": "Metric",
            "description": "Selects the similarity metric used to compare vectors in this Milvus collection. Choose `Inner Product` for normalized embeddings or `Euclidean` for distance-based comparisons. Other options support binary vectors.",
            "enum": ["Euclidean", "Inner Product", "Hamming", "Jaccard", "Tanimoto", "Substructure", "Superstructure"],
            "default": "Inner Product"
          }
        }
      }
    },
    "allow-recreate": {
      "type": "boolean",
      "title": "Override collections",
      "description": "Controls whether existing Milvus collections with the same name are dropped and recreated. When `false`, the job throws an exception if a collection with the same name already exists. Enable with caution to avoid data loss."
    },
    "type": {
      "type": "string",
      "title": "Spark Job Type",
      "enum": ["argo-milvus-create-collections"],
      "default": "argo-milvus-create-collections",
      "hints": ["readonly"]
    }
  },
  "additionalProperties": true,
  "category": "Other",
  "categoryPriority": 1
};

export const SchemaParamFields = ({schema}) => {
  const sanitize = str => {
    if (typeof str !== "string") return str;
    return str.replace(/^"(.*)"$/s, "$1").replace(/\\/g, "").replace(/"/g, "'");
  };
  const renderMd = str => {
    const s = sanitize(str);
    const text = (/[.!?]\)*$/).test(s) ? s : `${s}.`;
    return text.split(/(\*\*[^*]+\*\*|_[^_]+_|`[^`]+`)/g).map((part, i) => {
      if (part.startsWith("**")) return <strong key={i}>{part.slice(2, -2)}</strong>;
      if (part.startsWith("_")) return <em key={i}>{part.slice(1, -1)}</em>;
      if (part.startsWith("`")) return <code key={i}>{part.slice(1, -1)}</code>;
      return part;
    });
  };
  const {description, properties = {}, required: requiredProps = []} = schema;
  const visibleProps = useMemo(() => Object.entries(properties).filter(([, prop]) => !prop.hints?.includes("hidden")), [properties]);
  const renderProp = ([name, prop]) => {
    const isRequired = requiredProps.includes(name);
    const hasDefault = prop.default !== undefined;
    const rawDefault = prop.default;
    const hints = prop.hints || [];
    const isComplexDefault = hasDefault && (typeof rawDefault === "object" || typeof rawDefault === "string" && (rawDefault.length > 20 || rawDefault.includes('"')));
    const postBadges = [];
    if (prop.title) {
      postBadges.push(<><span className="text-stone-400 dark:text-stone-500">API property: </span>{name}</>);
    }
    const constraints = [];
    if (prop.minimum !== undefined && prop.maximum !== undefined) {
      constraints.push(`Range: ${prop.minimum} – ${prop.maximum}`);
    } else if (prop.minimum !== undefined) {
      constraints.push(`Min: ${prop.minimum}`);
    } else if (prop.maximum !== undefined) {
      constraints.push(`Max: ${prop.maximum}`);
    }
    if (prop.minLength !== undefined && prop.maxLength !== undefined) {
      constraints.push(`Length: ${prop.minLength} – ${prop.maxLength}`);
    } else if (prop.minLength !== undefined) {
      constraints.push(`Min length: ${prop.minLength}`);
    } else if (prop.maxLength !== undefined) {
      constraints.push(`Max length: ${prop.maxLength}`);
    }
    const fieldProps = {
      key: name,
      body: prop.title || name,
      type: prop.type,
      ...postBadges.length > 0 && ({
        post: postBadges
      }),
      ...isRequired && ({
        required: true
      }),
      ...!isComplexDefault && hasDefault ? {
        default: sanitize(String(rawDefault))
      } : {}
    };
    const isObject = prop.type === "object" && prop.properties;
    const isArrayOfObjects = prop.type === "array" && prop.items?.type === "object" && prop.items.properties;
    return <ParamField {...fieldProps}>
        {prop.description && <p>{renderMd(prop.description)}</p>}

        {prop.enum && <p>
            Allowed values: 
            {prop.enum.map((v, i) => <>{i > 0 && ", "}<code key={i}>{String(v)}</code></>)}
          </p>}

        {constraints.length > 0 && <p className="text-stone-500 dark:text-stone-400 text-sm">
            {constraints.join(" · ")}
          </p>}

        {isComplexDefault && <div className="flex">
            <p>
              <strong>Default:</strong>
            </p>
            <pre className="!my-0">
              <code>
                {JSON.stringify(rawDefault, null, 2)}
              </code>
            </pre>
          </div>}

        {isArrayOfObjects && <Expandable title="item properties">
            <SchemaParamFields schema={{
      properties: prop.items.properties,
      required: prop.items.required
    }} />
          </Expandable>}

        {isObject && <Expandable title="properties">
            <SchemaParamFields schema={{
      properties: prop.properties,
      required: prop.required
    }} />
          </Expandable>}
      </ParamField>;
  };
  return <div>
      {description && <p>{renderMd(description)}</p>}

      {visibleProps.map(renderProp)}
    </div>;
};

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/5/fusion/reference/config-ref/jobs/create-collections-in-milvus

[mintlify link]: https://doc.lucidworks.com/docs/5/fusion/reference/config-ref/jobs/create-collections-in-milvus

[old doc.lw link]: https://doc.lucidworks.com/fusion/5.9/10914

Creates collections with specified parameters in [Milvus](/docs/5/fusion/intro/fusion-stack/milvus).

<LwTemplate />

## Configuration properties

<SchemaParamFields schema={schema} />
