# Configure doc-id value for Aerospike Connect for Elasticsearch

An optional `doc-id` section of the `aerospike-elasticsearch-outbound.yaml` file defines how to generate an Elasticsearch’s document ID.

::: note
Aerospike lets Elasticsearch generate a doc-id by default.
:::

This field has the following two properties:

| Property | Required | Default | Description |
| --- | --- | --- | --- |
| source | Yes |  | Source for generating Elasticsearch’s `doc-id` value. |
| failure-strategy | No | `USE_DIGEST` | What to do if Aerospike can’t generate the `doc-id` value using the specified source. While not all sources are compatible with this configuration parameter, you can still generate the `doc-id` value using those sources. |

## Source values

The source field accepts the following values:

| Value | Description | Can configure failure-strategy |
| --- | --- | --- |
| none | The destination system will auto-generate the value or use null. | No |
| system-default | The connector sets a different default source. In this case, it is set to source none. | No |
| namespace | Use the record’s namespace as Elasticsearch’s `doc-id` value. | No |
| set | Use the record’s set name as Elasticsearch’s `doc-id` value. | Yes |
| digest | Use the record’s digest as Elasticsearch’s `doc-id` value. | No |
| user-key | Use the record’s user-key as Elasticsearch’s `doc-id` value. | Yes |
| bin-value | Use the record’s bin value of the given bin name as Elasticsearch’s `doc-id` value. | Yes |
| static | Use a static value as Elasticsearch’s `doc-id` value. | No |

## Failure Strategy values

While not all sources are compatible with this configuration parameter, you can still generate the `doc-id` value using those sources.

The failure-strategy field accepts the following values:

| Value | Description | Details |
| --- | --- | --- |
| USE\_DIGEST | Use the record’s digest as Elasticsearch’s `doc-id` value. | This value is always available. |
| FAIL | Send the temporary error to XDR so that it will retry the record. |  |
| IGNORE | Send the permanent error to XDR so that it will not retry the record. | In this situation, the record is never shipped to the destination system. |

## Examples

You can use any of the failure-strategy values wherever applicable. The following examples show usage of all failure-strategy values at different places.

### Source: none

```
…doc-id:  source: none…
```

### Source: system-default

```
…doc-id:  source: system-default…
```

### Source: namespace

```
…doc-id:  source: namespace…
```

### Source: set

```
…doc-id:  source: set  failure-strategy: USE_DIGEST…
```

### Source: digest

```
…doc-id:  source: digest…
```

### Source: user-key

```
…doc-id:  source: user-key  failure-strategy: FAIL…
```

### Source: bin-value

```
…doc-id:  source: bin-value  bin-name: color  failure-strategy: IGNORE…
```

### Source: static

```
…doc-id:  source: static  value: dummy_doc_id…
```