module-elasticsearch: include custom document id to batch upload (#30128)
* include custom document id to elasticsearch batch upload --------- Signed-off-by: Matheus Almeida <matheusjv14@gmail.com>
This commit is contained in:
@@ -239,6 +239,26 @@ search:
|
||||
|
||||
> You can also increase the batch size if you are using a large ES instance.
|
||||
|
||||
### Elasticsearch batch key field
|
||||
|
||||
By default, during bulk uploads with the Elasticsearch indexer, each document is assigned an auto-generated `_id` unless a `batchKeyField` is explicitly set. This configuration is optional and most users won’t need to customize it. However, if your use case involves frequent lookups or updates to existing documents, setting `batchKeyField` can be beneficial. It allows you to define a consistent identifier for each document, helping to streamline updates and prevent duplicate entries. Be aware that if the value provided for `batchKeyField` is not unique across documents, Elasticsearch will overwrite any existing document with the same `_id`.
|
||||
|
||||
**Using `batchKeyField` (Custom `_id`)**
|
||||
|
||||
```yaml
|
||||
search:
|
||||
elasticsearch:
|
||||
batchKeyField: document_id
|
||||
```
|
||||
|
||||
**Default Behavior (Auto-generated `_id`)**
|
||||
|
||||
```yaml
|
||||
search:
|
||||
elasticsearch:
|
||||
# No batchKeyField specified — Elasticsearch will autogenerate _id
|
||||
```
|
||||
|
||||
### Elasticsearch Index Name Customization
|
||||
|
||||
By default, the Elasticsearch indexer creates index names based on their type, a separator, and the current date as a postfix. You can configure a custom prefix for all indices by adding the following section to your app configuration.
|
||||
|
||||
Reference in New Issue
Block a user