elasticsearch/docs/reference
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
..
analysis Docs: Fix syntax on lang-analyzer 2014-07-30 20:17:27 +02:00
cat Docs: Made current version, branch and jdk into asciidoc attributes 2014-07-23 11:55:35 +02:00
cluster Docs: Made current version, branch and jdk into asciidoc attributes 2014-07-23 11:55:35 +02:00
docs Term Vectors API: adds support for wildcards in selected fields 2014-07-30 17:44:37 +02:00
images [doc] Correct decay function equations in function_score description 2014-07-23 17:33:22 +02:00
index-modules Update translog.asciidoc 2014-07-31 14:06:24 +02:00
indices Add `wait_if_ongoing` option to _flush requests 2014-07-24 15:34:53 +02:00
mapping Generate timestamp when path is null 2014-07-31 19:48:22 +02:00
migration
modules Docs: Fix typo in scripting.asciidoc 2014-07-29 12:30:09 +02:00
query-dsl Update nested-query.asciidoc 2014-07-26 22:32:28 +02:00
search _geo_distance sort: allow many to many geo point distance 2014-07-31 17:33:45 +02:00
setup Docs: Changing ES_MAX_MEM default from '1gb' to '1g' 2014-07-25 12:50:59 +02:00
testing
analysis.asciidoc
api-conventions.asciidoc
cat.asciidoc
cluster.asciidoc
docs.asciidoc
getting-started.asciidoc Docs: Made current version, branch and jdk into asciidoc attributes 2014-07-23 11:55:35 +02:00
glossary.asciidoc
index-modules.asciidoc
index.asciidoc Docs: Made current version, branch and jdk into asciidoc attributes 2014-07-23 11:55:35 +02:00
indices.asciidoc
mapping.asciidoc
modules.asciidoc
query-dsl.asciidoc
search.asciidoc Docs: Fixed path to search-shards 2014-07-26 15:05:53 +02:00
setup.asciidoc
testing.asciidoc