Writing to Qdrant from Apache Spark

Batch-loading embeddings from Spark or Databricks into self-hosted Qdrant with the Qdrant Spark connector, covering packaging, pre-created collections, vector field mapping, batch size and retries.

On this page

How Spark batch-loads embeddings into Qdrant with the Spark connector

A data engineering team that has embeddings sitting in Spark or Databricks and needs them searchable in a self-hosted Qdrant collection has one practical route: the Qdrant Spark connector, which writes DataFrame rows as points into a collection that already exists. Spark itself has no built-in vector store writer, so the connector is the piece that maps rows to Qdrant points. The collection, its vector size and its distance metric must be created in Qdrant before the job runs, because the connector writes into the structure you give it and does not design it for you. Confirm the connector's supported Spark and Scala combinations in its own documentation before you pick a build. Spark 4.2.0 was released on July 14, 2026, and Spark 4 is pre-built with Scala 2.13 and has dropped Scala 2.12, so a connector artifact built for the wrong Scala line will fail at load time, not at install time.

Most of the work sits in the mapping between DataFrame columns and Qdrant fields. Decide which column holds the vector, which holds the point ID, and which columns become payload fields that your filters will use later. Check the vector dimension in the DataFrame against the collection definition on a small sample before a full run, and check that IDs are unique, because a repeated ID overwrites an earlier point. Batch size and retry settings are the other main controls. Tune them against your cluster's memory and the write load your Qdrant nodes can absorb, and confirm the option names and retry behavior in the connector's documentation, since they vary by release. Spark's cluster overview describes the driver and executors that will open these write connections, so size the number of parallel writers with the Qdrant nodes in mind.

Access is the step teams most often skip. A self-hosted Qdrant instance ships with no authentication by default, so the Spark job needs an API key or a JWT scoped to write on the target collection, and that credential belongs in your secret store, not in notebook code. Run the job from a network segment that can reach Qdrant over the documented port without exposing Qdrant to other networks. Keep a record of each batch run, including row counts written and any rejected rows, so a failed load can be resumed or rerun without duplicating points. Before relying on the pipeline, load a representative sample into a test collection, compare point counts and a few sample searches against the source, and only then schedule the production run.

What you need before the first Spark write to Qdrant

Before a Spark job writes embeddings to Qdrant, four things must line up: a Spark version on a maintained branch, a Scala 2.13 build, a Qdrant node that accepts authenticated TLS connections, and storage that Qdrant can run on. The cards below cover each item and the connector package that ties them together.

Choose a maintained Spark line

Start from the newest line your platform team can support: Spark 4.2.0 was released on July 14, 2026, with maintenance releases 4.1.3 and 4.0.4 following. The 3.5.x line is a extended LTS that receives security fixes only until November 2027, so it suits teams that cannot move off Spark 3.5 yet. Confirm which branch your Databricks runtime or cluster image is built on before you pin a connector version.

Spark versioning policy

Build against Scala 2.13

Spark 4 is pre-built with Scala 2.13 and has officially dropped Scala 2.12 support. A connector jar compiled for the wrong Scala binary version fails at load time, often with errors that look like missing classes rather than a version mismatch. Ask the connector maintainer which Scala version each release targets, and match that suffix to your Spark build before you copy the jar to a cluster.

Spark downloads page

Reach a secured Qdrant node

Self-deployed Qdrant listens on all network interfaces and has no authentication by default, so the Spark job must connect to a node where an API key and TLS are configured. Confirm that the Spark executors, not only the driver, can reach the Qdrant gRPC and REST ports through your network policy. Store the API key in your secrets manager and pass it to the job at runtime, never in notebook code.

TLS and API key support
v1.2.0

Use block storage for Qdrant

Qdrant needs block-level storage with a POSIX-compatible file system and cannot run on NFS or S3-style object storage, with SSD or NVMe recommended. A Spark cluster can write quickly, so an undersized or network-mounted Qdrant volume becomes the bottleneck during bulk loads. Check the storage class of the Qdrant nodes before you size the batch job, not after the first failed write.

Pre-create the target collection

The connector writes into an existing collection, so the vector size, distance metric and any named vectors must be created in Qdrant first. A mismatch between the Spark DataFrame's vector length and the collection definition is one of the most common load failures. Decide the collection schema with the team that owns the embedding model, and record it in the job's configuration.

Confirm the connector package source

The Qdrant Spark connector is a community-maintained package, so confirm the exact artifact name, version and checksum against its source repository before you approve it for production. Check its license and its declared Spark and Scala compatibility. Attach the jar the same way your platform attaches other libraries: through the Databricks library settings, the spark-submit --jars or --packages option on standalone, YARN or Kubernetes clusters, or the image build for Kubernetes.

Configure the Spark job, from packaging to a verified write

This sequence takes a Spark or Databricks job from connector packaging to a full embedding load that you have checked against the source. The order matters: the Qdrant collection must exist with the right vector size and distance before the first batch arrives, and each step closes with a check you can repeat on later runs.

  1. Confirm version alignment before any install

    Record three versions before touching the cluster: the Spark build your platform runs, the Qdrant server release and the connector build you plan to use. Apache Spark 4.2.0 was released on July 14, 2026, and 3.5.9 followed as a maintenance release on July 16, 2026, so confirm which line your Databricks or self-managed cluster is on. Spark 4 is pre-built with Scala 2.13 and has dropped Scala 2.12, so the connector artifact must match that Scala binary version. Ask the connector maintainer which Qdrant server versions it supports. The step is done when a short note in your change record names all three versions.

  2. Package the connector for driver and executors

    Add the connector jar, or the package coordinates your build tool resolves, to both the driver and every executor classpath. On Databricks, attach it as a cluster library so it loads on all nodes. On self-managed Spark, pass it through the submit options your deployment uses, or include it in the container image if you run on Kubernetes. Driver-only installs often cause failures that appear only after tasks start. Pin the exact connector version in your repository so reruns use identical code. Check it by running a small job that loads the connector class inside an executor task and confirming it completes without a class-not-found error.

  3. Create the collection before the job runs

    Create the Qdrant collection ahead of time, because the batch writer expects the collection to exist. Set the vector size to the exact output dimension of your embedding model, and choose the distance metric that the model documentation recommends. If you plan to store more than one embedding per record, define named vectors now, since changing this later means rebuilding the collection. Create payload indexes for every field you will filter on. Run this step with an admin key, and keep the job on a write-scoped key. Check it by reading the collection info back and comparing the vector size and distance with a test embedding from your model.

  4. Map DataFrame vector and payload columns

    Map each DataFrame column to a role before the first write. One column holds the embedding as an array of floats whose length matches the collection's vector size. The remaining columns become payload fields. The point identifier must be a stable value, such as a source primary key, so that reruns update existing points and do not duplicate them. Cast types explicitly in Spark, and fix nulls in the vector column, since one bad row can fail a whole batch. Confirm the exact option names in the connector documentation for your version. Check it by writing a small sample and reading one point back to confirm its vector length and payload fields.

  5. Set batch size and write parallelism

    Set the batch size and the number of partitions that write at the same time. Batch size controls how many points each request carries, and the workable value depends on vector dimension, payload size, and the memory and network capacity of your Spark executors and Qdrant nodes. Start with a modest batch size and raise it while watching write latency and error rates on the Qdrant side. Limit concurrent writers so the cluster is not overloaded, and repartition the DataFrame to match. Keep both values in job configuration so operators can adjust them without code changes. Check it by running the sample at two batch sizes and recording throughput and error counts.

  6. Configure retries and failure handling

    Set retries at the batch level so that a transient timeout retries one batch while the rest of the job continues. Use backoff between attempts if the connector exposes that option, and cap the number of attempts so a broken cluster fails the job visibly. Retried writes are safe only when each point has the stable identifier from the mapping step, so confirm that before enabling retries. Record batches that still fail after the final attempt in a dead-letter location so they can be replayed. Confirm the retry and timeout option names in the connector documentation. Check it by stopping one node in a test cluster with a replication factor above one during a sample run, then confirming the job completes with the expected point count and no duplicates.

  7. Verify a sample write with search

    Verify a sample end to end before the full load. Choose a small slice of source rows that covers the range of your data, write it, and compare the point count in Qdrant with the row count for the same slice in the source table. Then run a known query: take the embedding of a record that already exists in the source, search the collection with it, and confirm that the same record returns at or near the top. Compare the payload on that result with the source row. A count mismatch often points to rejected batches, duplicate identifiers or a filter in the source query, so investigate those before scaling up.

  8. Run the full load and reconcile counts

    Run the full load with the verified settings, scheduled through the orchestrator your team uses, such as Databricks Workflows or Apache Airflow. Before a large reload, take a collection snapshot so you can roll back, and remember that snapshots restore only to clusters on the same or the next minor version. Record the Spark application ID, the source snapshot and any failed batches in the job log. When the job ends, compare source row counts with Qdrant point counts for each collection and run a fresh sample search. Store the reconciliation result with the job run. The load is complete when counts match or each difference has a documented cause and a replay plan.

Mapping DataFrame columns to Qdrant vectors and payload

This table maps each Spark DataFrame column to its Qdrant role, along with the rule to confirm before a job runs. Read it as a checklist: a mismatch in vector size or ID type usually fails the load or silently creates unusable points, so confirm each row against the target collection first.

Source columnQdrant targetRule to confirmCommon failure
Embedding array columnVector of the collectionArray length must equal the configured vector size, and the distance metric must match what the collection was created withLength mismatch rejects the batch, or the job runs against a collection built for a different model
ID columnPoint IDDecide whether IDs are unsigned integers or UUIDs and use one type for the whole collectionMixed ID types or string IDs that the connector does not accept stop the write partway through
Remaining scalar columnsPayload fieldsConfirm field names, types and nulls, since payload is schemaless but filters depend on consistent typesInconsistent types for the same key make filters miss records without an obvious error
Nested or array columnsNested payload objects or arraysConfirm the connector serializes these as you expect before loading production volumesStruct values stored as strings, which later filters cannot match
Fields used in filtersPayload indexesCreate payload indexes on filter fields before or right after loading, with the index type that matches the fieldUnindexed filter fields make searches slow on large collections
Large text or raw source fieldsPayload (kept small)Store only what retrieval needs in payload, and keep full source text in your system of recordOversized payloads inflate storage and slow point writes
Vector names (named vectors)Named vector fieldIf the collection uses named vectors, confirm the connector mapping names each one exactlyVectors written to a default name the collection does not define

How the connector moves rows through Spark executors

Spark runs the write as tasks, one per partition. Executors on the worker nodes run those tasks in parallel, while the driver coordinates them. Each task sends its rows to Qdrant in batches, so the number of partitions writing at the same time and the batch size multiply together to set the load on your Qdrant nodes. A high partition count with large batches can overwhelm a small Qdrant node even when the total data volume is modest. Before the production run, confirm the number of concurrent tasks your cluster will execute, the batch size the connector accepts, and the memory and CPU of your Qdrant nodes in a test environment. Watch indexing and memory use during the first runs and adjust the partitioning from there.

The connector writes into a collection that already exists, so the collection, its vector size, distance metric and payload indexes must be created in Qdrant before the job starts. A mismatch between the vector column in Spark and the collection definition is a common cause of failed writes, so check it on a small sample first. When a task fails partway through, Spark retries it, but batches that reached Qdrant before the failure stay in the collection, while other partitions may have finished or never started. The job status alone will not tell you which rows are present. Plan a count reconciliation between the source table and the collection after every failed or partial run, and confirm how the connector reports partial failures in its documentation.

The safe way to make reruns harmless is to derive each point ID from a stable key in the source row, such as its primary key, so a retried batch overwrites the same points instead of adding new ones. Test this by running one partition twice against a non-production collection and confirming the point count does not change. Confirm which ID types the connector accepts and how it handles a source key that is not already unique. Also check that the ID scheme is stable across Spark versions and data types, because a changed ID format on a rerun will create duplicates that look like valid data.

Securing Spark credentials and the write path to Qdrant

A Spark job that writes embeddings to Qdrant holds a credential with write access to your vector data, and it runs on a cluster that many people can reach. The cards below cover where that credential lives, which permissions it carries, how traffic travels, and what gets logged, so the write path can be reviewed like any other production service.

Keep API keys out of notebooks

Store the Qdrant API key in the Spark secret manager or Databricks secrets, then read it at job start through the secret scope or configuration reference your platform provides. Notebook cells, job parameters and driver logs are visible to anyone with workspace access, so a key pasted into a cell is effectively shared with every collaborator. Check that the key never appears in Spark event logs or stdout, and rotate it if it has been pasted anywhere.

Use a write-scoped credential

Qdrant supports admin and read-only API keys, and JWT-based access control with per-collection read or write permissions since v1.9.0. A batch loader should hold a credential that can write only to the target collection, never the admin key, because an admin key lets a compromised job drop collections or change cluster settings. Confirm the exact JWT claim format for your Qdrant version in the security docs before you build the token issuance step.

Qdrant security docs

Encrypt traffic from executors

Every executor opens its own connection to Qdrant, so a batch job multiplies the number of network paths that carry embeddings and payloads. Enable TLS for the REST and gRPC endpoints the connector uses, and confirm that the connector's client settings trust your internal certificate authority. Plaintext gRPC between executors and the database is a common gap, because the job works fine in testing before anyone checks the transport.

TLS for REST and gRPC
v1.2.0

Limit network paths to the Spark subnet

A self-deployed Qdrant instance listens on all network interfaces by default and has no authentication configured until you set it up. Place Qdrant on a private subnet and allow inbound traffic only from the subnets where Spark driver and executor nodes run, including any Databricks workspace or Kubernetes pod network that egresses through NAT. Test the rule from a machine outside that subnet to confirm the port is closed, and record the rule in your change log.

Qdrant security docs

Audit writes on the Qdrant side

Qdrant writes JSON audit logs of authenticated API operations since v1.17.0, which lets you tie each batch of upserts to the credential that made them. Forward these logs to your central log store and set alerts for unexpected deletes, collection drops or writes from unknown keys. Confirm that the log records include the collection name and the caller identity you need for investigations, because the fields you see in a test run determine what your auditors can reconstruct.

Review the Spark side of the trust boundary

Spark itself has no catalog or access control layer, so the controls on the cluster, the notebook workspace and the job scheduler decide who can run a job that holds the Qdrant credential. Restrict who can edit the job definition, read the secret scope and view driver logs, and treat the cluster as part of the same trust boundary as Qdrant. Ask your platform team which roles can read a secret scope, because that answer is often broader than the team expects.

Common Spark to Qdrant write failures and fixes

This table pairs each common failure when batch-writing embeddings from Spark into Qdrant with its likely cause and the fix to apply. Read it as a triage list: match the error your job shows, check the cause against your collection and connector setup, then apply the fix and rerun a small test batch before the full load.

FailureLikely causeFix
Collection not foundThe job assumes the connector will create the collection, but the target collection was never created with the right name, distance metric and vector size.Create the collection ahead of the Spark job with the same name and vector configuration, and confirm it exists on the target cluster before submitting.
Vector dimension mismatchThe embedding model produces vectors of a different length than the size the collection was created with, often after a model change.Confirm the embedding model's output size, recreate the collection with that size, and re-embed existing data rather than mixing vector lengths.
Unauthorized response from a read-only keyThe Spark job uses an API key with read-only rights, or a JWT whose per-collection permissions exclude writes to the target collection.Use a key or token with write permission on the target collection, store it in your secrets system, and test one write from the Spark environment.
Timeouts from oversized batchesThe configured batch size produces payloads too large or too slow for the node to accept within the client timeout, especially with large payloads or many vectors per point.Reduce the batch size and test with a sample, then increase it gradually while watching write latency and node load on the cluster.
Connector version mismatch with SparkThe Qdrant Spark connector build targets a different Spark or Scala line than the cluster runs, so the job fails at load or during the write.Match the connector artifact to your Spark and Scala versions, check the connector's documentation for supported lines, and test on a non-production cluster first.
Duplicate points after retriesA failed task is retried after part of its batch was already written, and the points have no stable IDs, so the same vectors are inserted again.Assign deterministic point IDs derived from source keys, so a retried write overwrites rather than duplicates, and count points after each run to confirm.

Questions buyers ask about Spark to Qdrant loading

What drives the cost of loading Qdrant from Spark?

The cost is mostly the time of the people doing the work and the compute used to run the load. Cluster time depends on how many embeddings you write, how large each vector is, how much work the embedding step adds, and how many Spark executors you can afford to run. Qdrant node sizing is a separate line: the target cluster needs enough RAM and disk for the collection and its replicas, and a replication factor of 2 doubles storage. The open-source Qdrant engine has no license fee, but cloud, Hybrid Cloud and Private Cloud options are priced differently, so confirm which deployment you are paying for. Ask any partner to split the quote into engineering effort, compute and Qdrant infrastructure, and to say which parts are one-time and which recur.

Can our internal team load Qdrant from Spark on its own?

Yes, if your team already runs Spark or Databricks and can operate a Qdrant server. The work involves packaging the connector, creating the target collections ahead of the load, mapping vector and payload fields, choosing batch sizes and handling retries. None of these steps is unusual for a data engineering team, but they interact: a collection created with the wrong vector size or distance metric has to be rebuilt. Teams that lack Spark or Qdrant operations experience usually benefit from a short pilot on a subset of the data before the full run. DeployOpen can plan and implement this work as a fixed-scope engagement, or hand over documentation for your team to run it.

How long does a Spark to Qdrant load take?

Duration depends on the number of vectors, their dimensions, payload size, the embedding step if it runs inside the job, the number of Spark executors and the write capacity of the Qdrant cluster. Larger datasets and bigger vectors take longer, while more executors can speed up the write side only until the Qdrant nodes become the bottleneck. A pilot run on a representative sample gives you the throughput you need to estimate the full load. Ask any partner to base the schedule on that measured rate rather than a general figure, and to state what will be measured, when, and on which cluster size.

What must our team provide before the engagement starts?

You need to provide four things. First, read access to the source data in your lake, warehouse or table catalog, along with a description of its schema and any personal or regulated fields. Second, a Qdrant environment you control, with network reachability from the Spark cluster, the chosen storage class and an agreed API key or access scheme. Third, a decision on the embedding model, including whether vectors are precomputed in the source or generated during the Spark job, and the dimensions and distance metric it produces. Fourth, a named owner who can approve the collection design. Confirm with your Spark platform team which Spark version and Scala build you run, since these affect connector packaging.

How do we handle re-embedding when the embedding model changes?

Re-embedding means generating new vectors for existing records, which usually cannot be mixed with old vectors in the same collection because similarity scores depend on the model. The safe pattern is to create a new collection sized for the new model, run a full Spark job into it, validate search quality, then switch the application to the new collection and retire the old one. Keep the source text and metadata versioned so the job can be rerun. Plan for the cost of a full pass over the corpus each time you change models, and schedule incremental jobs for new or changed records between full runs.

What goes wrong most often in Spark to Qdrant jobs?

The most common failures are a collection created with the wrong vector dimension or distance metric, a batch size that overloads the Qdrant node, and retries that write duplicate points when point IDs are not stable. Network paths from executors to Qdrant that work for a notebook may fail under cluster load, and unsecured default Qdrant instances expose their interfaces to any reachable host. Before running the full load, confirm point ID strategy, idempotent retries, the batch size measured in a pilot, and that the target cluster has enough capacity for the replicas you plan to keep.

Does the load need to be secured before we run it?

Yes. Self-deployed Qdrant listens on all network interfaces and has no authentication configured by default, so the target must be secured before Spark writes to it. Use an API key or JWT-based access with write permission limited to the loading collections, enable TLS for traffic from the Spark cluster, and restrict network access to the executor subnets. Audit logging of authenticated operations is available in recent releases, so confirm the version you run supports it. Store the key in your secrets manager and avoid placing it in notebook code.

How the Spark job reaches the Qdrant cluster

The job starts in the Spark driver, which plans the work and hands partitions to executors on worker nodes. Each executor reads its share of source tables and sends embedding batches to the Qdrant endpoint, so the Qdrant API key and TLS settings must be provisioned on the executors, not only the driver. Check that the Qdrant cluster is reachable from every executor subnet and that the target collections already exist before the first batch runs.

Spark driver and executors writing batches to a Qdrant cluster across a trust boundary.

How DeployOpen scopes and delivers the Spark to Qdrant integration

DeployOpen plans, builds, tests and hands over Spark to Qdrant batch loading inside infrastructure you control, whether that is your Spark cluster, a Databricks workspace or a Kubernetes platform. Each engagement starts from a written scope that names the Spark and connector versions, the Qdrant deployment, the collections and the load pipeline.

How we scope

  • Inventory the Spark or Databricks environment, Spark version and Scala build, and where the connector jar will be packaged and stored.
  • Confirm the Qdrant topology, collection definitions, vector names, payload fields and the access model each loading job will use.
  • Agree in writing the batch size approach, retry behavior, failure handling and which load runs are in scope before work starts.

How we build

  • Package the Qdrant Spark connector for your cluster and pin its version so driver and executor classpaths match across environments.
  • Create the target collections ahead of each job and map DataFrame columns to named or unnamed vector fields and payload keys.
  • Tune batch size and retries against a staging Qdrant instance, then record the settings and the reasons for them in the runbook.

How we hand over

  • Deliver the job code, connector configuration, collection creation scripts and a run checklist your data engineers can repeat.
  • Document how to verify each load with point counts, sampled payload checks and a test search against known vectors.
  • Walk your platform and security teams through credentials, network paths and the controls that protect Qdrant during loads.

How we support

  • Support is available as a retainer for connector upgrades, Spark version changes and changes to collection schemas.
  • Retest the pipeline after Spark or Qdrant upgrades, including the Qdrant version compatibility of the connector you run.
  • Review load failures and retry behavior with your team after incidents, and update the runbook with what was learned.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.