OpenSearch/docs/reference/mapping
David Pilato 85eb0ea0e7 Generate timestamp when path is null
Index process fails when having `_timestamp` enabled and `path` option is set.
It fails with a `TimestampParsingException[failed to parse timestamp [null]]` message.

Reproduction:

```
DELETE test
PUT  test
{
    "mappings": {
        "test": {
            "_timestamp" : {
                "enabled" : "yes",
                "path" : "post_date"
            }
        }
    }
}
PUT test/test/1
{
  "foo": "bar"
}
```

You can define a default value for when timestamp is not provided
within the index request or in the `_source` document.

By default, the default value is `now` which means the date the document was processed by the indexing chain.

You can disable that default value by setting `default` to `null`. It means that `timestamp` is mandatory:

```
{
    "tweet" : {
        "_timestamp" : {
            "enabled" : true,
            "default" : null
        }
    }
}
```

If you don't provide any timestamp value, indexation will fail.

You can also set the default value to any date respecting timestamp format:

```
{
    "tweet" : {
        "_timestamp" : {
            "enabled" : true,
            "format" : "YYYY-MM-dd",
            "default" : "1970-01-01"
        }
    }
}
```

If you don't provide any timestamp value, indexation will fail.

Closes #4718.
Closes #7036.
2014-07-31 19:48:22 +02:00
..
fields Generate timestamp when path is null 2014-07-31 19:48:22 +02:00
types [DOCS] Fix nested root object indexing documentation 2014-07-23 18:34:27 +02:00
conf-mappings.asciidoc Migrated documentation into the main repo 2013-08-29 01:24:34 +02:00
date-format.asciidoc [DOCS] fixed typo in date-format.asciidoc 2014-06-05 19:49:20 +02:00
dynamic-mapping.asciidoc [DOCS] Fix grammar in dynamic mappings 2014-06-04 08:56:15 +02:00
fields.asciidoc Index field names of documents. 2014-06-19 11:50:06 +02:00
meta.asciidoc Migrated documentation into the main repo 2013-08-29 01:24:34 +02:00
transform.asciidoc [DOCS] move all coming tags to added in master 2014-07-23 16:37:19 +02:00
types.asciidoc Replaced the multi-field type in favour for the multi fields option that can be set on any core field. 2014-01-13 09:21:53 +01:00