|
| 1 | +# Typesense |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +Outputs data to `Typesense`. |
| 6 | + |
| 7 | +## Key Features |
| 8 | + |
| 9 | +- [ ] [Exactly Once](../../concept/connector-v2-features.md) |
| 10 | +- [x] [CDC](../../concept/connector-v2-features.md) |
| 11 | + |
| 12 | +## Options |
| 13 | + |
| 14 | +| Name | Type | Required | Default Value | |
| 15 | +|------------------|--------|----------|------------------------------| |
| 16 | +| hosts | array | Yes | - | |
| 17 | +| collection | string | Yes | - | |
| 18 | +| schema_save_mode | string | Yes | CREATE_SCHEMA_WHEN_NOT_EXIST | |
| 19 | +| data_save_mode | string | Yes | APPEND_DATA | |
| 20 | +| primary_keys | array | No | | |
| 21 | +| key_delimiter | string | No | `_` | |
| 22 | +| api_key | string | No | | |
| 23 | +| max_retry_count | int | No | 3 | |
| 24 | +| max_batch_size | int | No | 10 | |
| 25 | +| common-options | | No | - | |
| 26 | + |
| 27 | +### hosts [array] |
| 28 | + |
| 29 | +The access address for Typesense, formatted as `host:port`, e.g., `["typesense-01:8108"]`. |
| 30 | + |
| 31 | +### collection [string] |
| 32 | + |
| 33 | +The name of the collection to write to, e.g., "seatunnel". |
| 34 | + |
| 35 | +### primary_keys [array] |
| 36 | + |
| 37 | +Primary key fields used to generate the document `id`. |
| 38 | + |
| 39 | +### key_delimiter [string] |
| 40 | + |
| 41 | +Sets the delimiter for composite keys (default is `_`). |
| 42 | + |
| 43 | +### api_key [config] |
| 44 | + |
| 45 | +The `api_key` for secure access to Typesense. |
| 46 | + |
| 47 | +### max_retry_count [int] |
| 48 | + |
| 49 | +The maximum number of retry attempts for batch requests. |
| 50 | + |
| 51 | +### max_batch_size [int] |
| 52 | + |
| 53 | +The maximum size of document batches. |
| 54 | + |
| 55 | +### common options |
| 56 | + |
| 57 | +Common parameters for Sink plugins. Refer to [Common Sink Options](../source-common-options.md) for more details. |
| 58 | + |
| 59 | +### schema_save_mode |
| 60 | + |
| 61 | +Choose how to handle the target-side schema before starting the synchronization task: |
| 62 | +- `RECREATE_SCHEMA`: Creates the table if it doesn’t exist, and deletes and recreates it if it does. |
| 63 | +- `CREATE_SCHEMA_WHEN_NOT_EXIST`: Creates the table if it doesn’t exist, skips creation if it does. |
| 64 | +- `ERROR_WHEN_SCHEMA_NOT_EXIST`: Throws an error if the table doesn’t exist. |
| 65 | + |
| 66 | +### data_save_mode |
| 67 | + |
| 68 | +Choose how to handle existing data on the target side before starting the synchronization task: |
| 69 | +- `DROP_DATA`: Retains the database structure but deletes the data. |
| 70 | +- `APPEND_DATA`: Retains both the database structure and the data. |
| 71 | +- `ERROR_WHEN_DATA_EXISTS`: Throws an error if data exists. |
| 72 | + |
| 73 | +## Example |
| 74 | + |
| 75 | +Simple example: |
| 76 | + |
| 77 | +```bash |
| 78 | +sink { |
| 79 | + Typesense { |
| 80 | + source_table_name = "typesense_test_table" |
| 81 | + hosts = ["localhost:8108"] |
| 82 | + collection = "typesense_to_typesense_sink_with_query" |
| 83 | + max_retry_count = 3 |
| 84 | + max_batch_size = 10 |
| 85 | + api_key = "xyz" |
| 86 | + primary_keys = ["num_employees","id"] |
| 87 | + key_delimiter = "=" |
| 88 | + schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST" |
| 89 | + data_save_mode = "APPEND_DATA" |
| 90 | + } |
| 91 | +} |
| 92 | +``` |
| 93 | + |
0 commit comments