First time creating a connector? Read this first.
Requirements
You will need:- Unstructured Pipelines and Unstructured API support Milvus cloud-based instances (such as Milvus on IBM watsonx.data, or Zilliz Cloud).
- Unstructured Ingest supports both local and cloud-based Milvus instances.
IBM watsonx.data
For Milvus on IBM watsonx.data, you will need:- An IBM Cloud account.
- An IBM watsonx.data Lite plan or Enterprise plan within your IBM Cloud account. If you are provisioning a Lite plan, be sure to choose the Generative AI use case when prompted, as this is the only use case offered that includes Milvus.
-
A Milvus service instance in IBM watsonx.data.
- If you are creating a Milvus service instance within a watsonx.data Lite plan, when you are prompted to choose a Milvus instance size, you can only select Lite. Because the Lite Milvus instance size is recommended only for 384 dimensions, you should also use an embedding model that uses 384 dimensions only.
- If you are creating a Milvus service instance within a watsonx.data Enterprise plan, you can choose any available Milvus instance size. However, all Milvus instance sizes other than Custom are recommended only for 384 dimensions, which means you should use an embedding model that uses 384 dimensions only. The Custom Milvus instance size is recommended for any number of dimensions.
-
The URI of the instance, which takes the format of
https://, followed by the instance’s GRPC host, followed by a colon and the GRPC port. This takes the format ofhttps://<host>:<port>. To get the instance URI- Sign in to your IBM Cloud account.
- On the sidebar, click the Resource list icon. If the sidebar is not visible, click the Navigation Menu icon to the far left of the title bar.
- Expand Databases, and then click the name of the target watsonx.data plan.
- Click Open web console.
- On the sidebar, click Infrastructure manager. If the sidebar is not visible, click the Global navigation icon to the far left of the title bar.
- Click the target Milvus service instance.
- On the Details tab, under Type, click View connect details.
- Under Service details, expand GRPC, and note the value of GRPC host and GRPC port.
- Sign in to your IBM Cloud account.
- The name of the database in the instance.
- The name of the collection in the database. Note the collection requirements at the end of this section.
-
The username and password to access the instance.
-
The username for Milvus on IBM watsonx.data is typically
ibmlhapikey.More recent versions of Milvus on IBM watsonx.data requireibmlhapikey_<your-IBMid>instead, where<your-IBMid>is your IBMid, for exampleme@example.com. To get your IBMid, do the following:- Sign in to your IBM Cloud account.
- In the title bar, click Manage and then, under Security and access, click Access (IAM).
- In the sidebar, expand Manage identities, and then click Users.
- In the list of users, click your user name.
- On the User details tab, in the Details tile, note the value of IBMid.
-
The password for Milvus on IBM watsonx.data is in the form of an IBM Cloud user API key.
To create an IBM Cloud user API key
- Sign in to your IBM Cloud account.
- In the title bar, click Manage and then, under Security and access, click Access (IAM).
- On the sidebar, under Manage identities, click API keys. If the sidebar is not visible, click the Navigation Menu icon to the far left of the title bar.
- Click Create.
- Enter some Name for the API key.
- Optionally, enter some Description for the API key.
- For Leaked action, leave Disable the leaked key selected.
- For Session management, leave No selected.
- Click Create.
- Click Download (or Copy), and then download the API key to a secure location (or paste the copied API key into a secure location). You won’t be able to access this API key from this dialog again. If you lose this API key, you can create a new one (and you should then delete the old one).
- Sign in to your IBM Cloud account.
-
The username for Milvus on IBM watsonx.data is typically
Zilliz Cloud
For Zilliz Cloud, you will need:- A Zilliz Cloud account.
- A Zilliz Cloud cluster.
-
The URI of the cluster, also known as the cluster’s public endpoint, which takes a format such as
https://<cluster-id>.<cluster-type>.<cloud-provider>-<region>.cloud.zilliz.com. To get the cluster public endpoint value- After you sign in to your Zilliz Cloud account, on the sidebar, in the list of available projects, select the project that contains the cluster.
- On the sidebar, click Clusters.
- Click the tile for the cluster.
- On the Cluster Details tab, on the Connect subtab, copy the Public Endpoint value.
-
The username and password to access the cluster.
To get the username and password
- After you sign in to your Zilliz Cloud account, on the sidebar, in the list of available projects, select the project that contains the cluster.
- On the sidebar, click Clusters.
- Click the tile for the cluster.
- On the Users tab, copy the name of the user.
- Next to the user’s name, under Actions, click the ellipsis (three dots) icon, and then click Reset Password.
- Enter a new password for the user, and then click Confirm. Copy this new password.
- The name of the database in the instance.
-
The name of the collection in the database.
The collection must have a defined schema before Unstructured can write to the collection. The minimum viable
schema for Unstructured contains only the fields
element_id,embeddings,record_id, andtext, as follows.typeis an optional field, but highly recommended. For settings for additional Unstructured-produced fields, such as the ones withinmetadata, see the usage notes toward the end of this section and adapt them to your specific needs.In the Create Index area for the collection, next to Vector Fields, click Edit Index. Make sure that for theembeddingsfield, the Field Type is set to FLOAT_VECTOR and the Metric Type is set to Cosine.Fields with a VARCHAR data type are limited to a maximum length of 65,535 characters. Attempting to exceed this character count will cause Unstructured to throw errors when attempting to write to a Milvus collection, and the associated Unstructured job could fail. For example,metadatafields that typically exceed these character counts includeimage_base64andorig_elements.Therecord_id,element_id, andidfields are closely related, but each has a distinct purpose. For more information, see How connectors use record IDs, element IDs, and IDs.
Milvus local
For Milvus local, you will need:- A Milvus instance.
- The URI of the instance.
- The name of the database in the instance.
- The name of the collection in the database. Note the collection requirements at the end of this section.
- The username and password, or token to access the instance.
Minimal required schema
All Milvus instances require the target collection to have a defined schema before Unstructured can write to the collection. The minimum viable schema for Unstructured contains only the fieldselement_id, embeddings, record_id, and text, as follows.
type is an optional field, but highly recommended.
The
record_id, element_id, and id fields are closely related, but each has a distinct purpose. For more information, see How connectors use record IDs, element IDs, and IDs.MilvusClient arguments to connect to other types of Milvus deployments, see your Milvus provider’s documentation:
Python
Storing document metadata
Unstructured offers the following options for storing document metadata in the destination table:-
Store the metadata as a single nested JSON field:
-
Flatten the metadata by writing each metadata field as its own typed, queryable column:
- Performing dot.notation queries on the stored JSON is sufficient for your needs.
- Document metadata schemas vary across file sources. When flattening document metadata, Unstructured drops fields that do not match existing columns in the schema.
- You want the connector to automatically generate the destination table. This option is not supported when flattening document metadata.
- You want to query individual metadata fields directly using standard SQL, without JSON parsing.
- The business intelligence or analytics tools you are using require columnar data.
flatten_metadata to false (in the Unstructured API). To flatten the metadata, check Flatten Metadata, or set flatten_metadata to true.
For Milvus destination connectors, flattening the metadata is the default.
Fields with a
DataType.VARCHAR data type are limited to a maximum length of 65,535 characters. Attempting to exceed this character count
will cause Unstructured to throw errors when attempting to write to a Milvus collection, and the associated Unstructured job could fail.
For example, metadata fields that typically exceed these character counts include image_base64 and orig_elements.Considerations when flattening metadata
Considerations to keep in mind when creating the destination collection:- The collection must contain a column for each metadata field you want to store. Any metadata field that does not have a corresponding column in the collection is silently dropped, although the event is written to the logs. For more information, see Logging and monitoring.
- Do not declare metadata columns as
NOT NULL. Missing metadata values are written asNULL. - Unstructured passes values through as their JSON-native type: strings, numbers, boolean, and so on. For example, no special formatting is applied to timestamp values.
- Metadata fields that are lists are not further flattened. Lists remain single columns.
Metadata flattening example
The following example demonstrates how Unstructured flattens metadata into separate columns. Consider the following metadata:protocol, which is included in the record_locator object, which is in turn within data_source, becomes data_source_record_locator_protocol:
Examples
To create a Milvus destination connector, see the following examples. For more information on working with destination connectors using the Unstructured API, see Destination endpoints.Configuration settings
Replace the preceding placeholders as follows:A unique name for this connector.
The username to access the Milvus instance.
The URI of the instance, for example:
https://12345.serverless.gcp-us-west1.cloud.zilliz.com.The name of the database in the instance.
The password corresponding to the username to access the instance.
The name of the collection in the database.
Set to
true to have Unstructured flatten the metadata and store each field as a separate columns, or false to store document metadata as nested JSON in a single column. For more information, see Storing document metadata.An array of fields to include, for example:
["element_id","embeddings","record_id","text","type"]. Leave blank to include all fields.If you set metadata_flatten to true, Unstructured names metadata fields according to the convention described in the Metadata flattening example. Any metadata field that does not have a corresponding column in the collection is silently dropped, although the event is written to the logs. For more information, see Logging and monitoring.
