Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the path option in the _timestamp field #9058

Closed
clintongormley opened this issue Dec 24, 2014 · 3 comments
Closed

Deprecate the path option in the _timestamp field #9058

clintongormley opened this issue Dec 24, 2014 · 3 comments
Assignees

Comments

@clintongormley
Copy link
Contributor

This was suggested in #6730 (comment) but it feels like a separate discussion, so I've opened this issue.

Removing the path parameter from _routing and _id has real benefits: we don't have to parse the body of the document on the coordinating node just to figure out which node should handle an indexing request. However, the _timestamp field doesn't have the same issue.

Currently the _timestamp field has two uses:

  • its value can be auto-generated
  • it is used with the _ttl functionality

If you're not using _ttl then it makes no sense extracting the _timestamp from a field in your document. Just query the field directly instead of making a redundant copy of it.

For auto-generated timestamps, I think you probably always want them to be auto-generated, or you always want to provide them yourself. So having logic to extract the timestamp from a field, and auto-generate a value if one isn't provided feels pretty much redundant.

The options are:

  1. Remove the path option from _timestamp

The _timestamp field will primarily be used with auto-generated timestamps. If the user wants to use the _ttl feature with a predefined timestamp, then they should specify that value manually at index/update time, with ?timestamp=...

  1. Add a path option to the _ttl

The _ttl will use the auto-generated _timestamp field by default, but can access a field within the document body instead (and fall back to an auto-generated value if none is specified). This option rather complicates things: what if the user uses the _timestamp field AND a _ttl.path?

  1. Leave things as they are
@jpountz
Copy link
Contributor

jpountz commented Dec 24, 2014

I like removing the path option for two reasons:

  • The more configuration metadata fields have, the harder they are to deal with.
  • It removes questions such as "if there are both a timestamp to extract in my document, and a timpestamp in the indexing request (?timestamp=...), who wins?"

If we consider that the _timestamp field is only useful in the context of the _ttl feature (eg. if all other use-cases can be solved by using a regular field), then another option would be to remove the _timestamp field mapper and leave the responsibility to the _ttl field mapper to serialize the original timestamp if it needs it.

@clintongormley
Copy link
Contributor Author

If we consider that the _timestamp field is only useful in the context of the _ttl feature (eg. if all other use-cases can be solved by using a regular field), then another option would be to remove the _timestamp field mapper and leave the responsibility to the _ttl field mapper to serialize the original timestamp if it needs it.

I think that this is probably true, but perhaps some users want auto-generated timestamps that are not related to _ttl?

@clintongormley
Copy link
Contributor Author

Closed by #11794

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants