NoSQL Destinations
NoSQL destinations write to ten stores, one collection or table per output.
Providers: mongodb | cassandra | dynamodb | cosmosdb | hbase | elasticsearch | solr | firestore | rethinkdb | couchdb
Output fields
Every output in this type carries these fields; provider and format values live under options.
| Field | Type | Default | Notes |
|---|---|---|---|
name (required) | string | - | - |
mode (required) | overwrite or append | - | - |
from (required) | string | - | - |
table (required) | string | - | - |
Minimal example
A complete nosql destination with one output, written for provider mongodb:
Code
Providers
mongodb
An example for provider mongodb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Output options
outputs[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
comment | string | - | The comment to append to the write operation. Comments appear in the output of the Database Profiler. |
mongo_client_factory | string | - | MongoClientFactory configuration key. You can specify a custom implementation that must implement the com.mongodb.spark.sql.connector.connection.MongoClientFactory interface. Default: com.mongodb.spark.sql.connector.connection.DefaultMongoClientFactory. Maps to mongoClientFactory. |
convert_json | any or objectOrArrayOnly or false | - | Specifies if the connector parses string values and converts extended JSON into BSON. any: The connector converts all JSON values to BSON. objectOrArrayOnly: The connector converts only JSON objects and arrays to BSON. false: The connector leaves all values as strings. Default: false. Maps to convertJson. |
id_field_list | string | - | Specifies a field or list of fields by which to split the collection data. To specify more than one field, separate them using a comma. Default: _id. Maps to idFieldList. |
ignore_null_values | boolean | - | When true, the connector ignores any null values when writing, including null values in arrays and nested documents. Default: false. Maps to ignoreNullValues. |
max_batch_size | integer | - | Specifies the maximum number of operations to batch in bulk operations. Default: 512. Maps to maxBatchSize. |
operation_type | insert or replace or update | - | Specifies the type of write operation to perform. insert: Insert the data. replace: Replace an existing document that matches the idFieldList value with the new data. update: Update an existing document that matches the idFieldList value with the new data. Default: replace. Maps to operationType. |
ordered | boolean | - | Specifies whether to perform ordered bulk operations. Default: true. |
upsert_document | boolean | - | When true, replace and update operations insert the data if no match exists. For time series collections, you must set upsertDocument to false. Default: true. Maps to upsertDocument. |
write_concern_w | string | - | Specifies w, a write-concern option requesting acknowledgment that the write operation has propagated to a specified number of MongoDB nodes. Default: Acknowledged. Maps to writeConcern.w. |
write_concern_journal | boolean | - | Specifies j, a write-concern option requesting acknowledgment that the data has been written to the on-disk journal for the criteria specified in the w option. Maps to writeConcern.journal. |
write_concern_w_timeout | integer | - | Specifies wTimeoutMS, a write-concern option to return an error when a write operation exceeds the specified number of milliseconds. Must be a nonnegative integer. Maps to writeConcern.wTimeoutMS. |
force_delete_temp_checkpoint_location | boolean | - | A Boolean value that specifies whether to delete existing checkpoint data. This setting applies only to streaming writes. Default: false. Maps to forceDeleteTempCheckpointLocation. |
truncate_mode | truncate or drop | - | Specifies the mode to use when truncating the collection. truncate: Truncate the collection. drop: Drop the collection. Default: truncate. Maps to truncateMode. |
ignore_duplicates_on_insert | boolean | - | Specifies whether to ignore duplicates when inserting. Default: false. Maps to ignoreDuplicatesOnInsert. |
cassandra
An example for provider cassandra:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Output options
outputs[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
batch_size | integer | - | Number of rows per batch. Default: 100. Maps to spark.cassandra.output.batch.size.rows. |
batch_size_bytes | integer | - | Maximum total size of a single batch (bytes). Default: 1024. Maps to spark.cassandra.output.batch.size.bytes. |
concurrent_writes | integer | - | Maximum number of batches executed in parallel by a single Spark task. Default: 5. Maps to spark.cassandra.output.concurrent.writes. |
consistency_level | ALL or EACH_QUORUM or QUORUM or LOCAL_QUORUM or ONE or TWO or THREE or LOCAL_ONE or ANY or SERIAL or LOCAL_SERIAL | - | Consistency level for write operations. Default: LOCAL_QUORUM. Maps to spark.cassandra.output.consistency.level. |
ignore_nulls | boolean | - | Ignore null values when writing. Default: false. Maps to spark.cassandra.output.ignoreNulls. |
ttl | integer | - | Time to live (TTL) in seconds for written rows. Maps to spark.cassandra.output.ttl. |
timestamp | integer | - | Timestamp in microseconds for written rows. Maps to spark.cassandra.output.timestamp. |
if_not_exists | boolean | - | Use IF NOT EXISTS clause when inserting. Default: false. Maps to spark.cassandra.output.ifNotExists. |
dynamodb
An example for provider dynamodb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.access_key (required) | string | - | - |
auth.secret_key (required) | string | - | - |
auth.region | string | - | - |
cosmosdb
An example for provider cosmosdb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.account_key (required) | string | - | - |
hbase
An example for provider hbase:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth | object | - | - |
auth.user | string | - | - |
auth.password | string | - | - |
Output options
outputs[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
catalog | string | - | JSON string defining the HBase table schema and column mappings. Required for writing. |
use_hbase_context | boolean | - | Whether to use HBaseContext for optimized operations. Default: true. Maps to hbase.spark.use.hbasecontext. |
bulk_load | boolean | - | Enable bulk load mode for faster writes. Default: false. Maps to bulkload. |
bulk_load_staging_directory | string | - | Staging directory for bulk load operations. Maps to bulkload.staging.dir. |
timestamp | string | - | Timestamp to use for writing data. Can be a specific timestamp or 'current'. |
max_versions | integer | - | Maximum number of versions to keep per cell. Maps to maxVersions. |
elasticsearch
An example for provider elasticsearch:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth is one of:
Variant
Variant
Output options
outputs[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
nodes_wan_only | boolean | true | Set to true if connecting over WAN or through a load balancer. Disables node discovery. Default: false. Maps to es.nodes.wan.only. |
write_operation | index or create or update or upsert | - | Write operation type. index: Index document (overwrites if exists). create: Create document (fails if exists). update: Update document (fails if not exists). upsert: Update or insert document. Default: index. Maps to es.write.operation. |
mapping_id | string | - | Field name to use as document ID. If not specified, Elasticsearch generates IDs. Maps to es.mapping.id. |
mapping_parent | string | - | Field name to use as parent document ID. Maps to es.mapping.parent. |
mapping_join | string | - | Field name to use for join field (parent-child relationships). Maps to es.mapping.join. |
mapping_routing | string | - | Field name to use for document routing. Maps to es.mapping.routing. |
mapping_version | string | - | Field name to use as document version. Maps to es.mapping.version. |
mapping_version_type | internal or external or external_gte | - | Version type for document versioning. Maps to es.mapping.version.type. |
batch_size | integer | - | Number of documents per batch. Default: 1000. Maps to es.batch.size.entries. |
batch_size_bytes | integer | - | Maximum batch size (bytes). Default: 1MB. Maps to es.batch.size.bytes. |
batch_write_retry_count | integer | - | Number of retries for failed batch writes. Default: 3. Maps to es.batch.write.retry.count. |
batch_write_retry_wait | string | - | Wait time between retries (e.g., '10s', '1m'). Default: 10s. Maps to es.batch.write.retry.wait. |
ssl | boolean | - | Enable SSL/TLS for connections. Default: false. Maps to es.net.ssl. |
solr
An example for provider solr:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Output options
outputs[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
batch_size | integer | 1000 | Number of documents sent to Solr via HTTP call during indexing. Set higher if docs are small and memory is available. Default: 500. |
commit_within | integer | 5000 | Sets commitWithin on indexing requests processed by SolrClient. Value should be in milliseconds. Default: None. |
generate_unique_key | boolean | true | Generate unique value for each document before indexing if documents are missing the unique key (derived from Solr schema). Instead, UUIDUpdateProcessorFactory can be used. Default: false. Maps to gen_uniq_key. |
soft_commit | integer | 10 | The interval (seconds) for soft commits, which make updates visible to search without the overhead of a hard commit. This allows for faster visibility of changes while still ensuring that data is eventually committed to stable storage. Default: None. Maps to soft_commit_secs. |
solr_field_types | string | - | Specify field type for fields written to Solr (e.g., rating |
firestore
An example for provider firestore:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
project_id (required) | string | - | - |
database (required) | string | - | - |
url | string | - | - |
auth | object | - | Firestore auth. Provide service_account_json for GCP; omit for the emulator or to use Application Default Credentials. |
auth.service_account_json (required) | string | - | Inline GCP service account JSON. |
rethinkdb
An example for provider rethinkdb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
couchdb
An example for provider couchdb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Streaming query options
These apply to every output in a streaming pipeline:
| Field | Type | Default | Notes |
|---|---|---|---|
output_mode | append or complete or update | append | Output mode of the streaming query. append: only new rows; complete: full result table; update: only updated rows (since 2.0). Maps to outputMode. |
trigger_interval | string | - | Trigger interval for processing (e.g. '10 seconds', '1 minute'). When set, uses Trigger.ProcessingTime(interval). Maps to triggerInterval. |
checkpoint_location | string | - | Optional custom checkpoint directory. When not set, a default under /app/data/spark-checkpoints/ is used. Maps to checkpointLocation. |
query_name | string | - | Name for the streaming query (for monitoring and debugging). Maps to queryName. |