-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
TSDB: Initial reindex fix #86647
TSDB: Initial reindex fix #86647
Conversation
It turns out that there is a fairly simple recipe for reindexing to a `time_series` index: 1. If you are reindexing from a time series index to a time series index and *not* changing the `@timestamp` or dimensions it "just works"(TM). 2. If you are reindexing from a standard index with a standard random `_id` you should clear it on reindex. 3. If you are reindexing from tsdb index to a tsdb index and modifying a dimension or `@timestamp` then you should clear the `_id`. This is not pleasant to have to remember. But it doesn't crash!
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Pinging @elastic/es-distributed (Team:Distributed) |
Hi @nik9000, I've created a changelog YAML for you. |
Pinging @elastic/clients-team (Team:Clients) |
This teaches reindex the smallest thing that it needs to know about tsdb: `_id` is automatically generated. Armed with that knowledge reindex now doesn't attempt to copy the `_id` when writing to a tsdb index. Important: If the index doesn't yet exist it will *assume* that the index will be created in `standard` mode. We can detect what mode it *should* be created with in a follow up change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -285,7 +300,7 @@ protected RequestWrapper<IndexRequest> buildRequest(ScrollableHitSource.Hit doc) | |||
} | |||
|
|||
// id and source always come from the found doc. Scripts can change them but they operate on the index request. | |||
index.id(doc.getId()); | |||
index.id(destinationIndexIdMapper.reindexId(doc.getId())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will probably also speed reindex up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. It's a noop for standard indices. For tsdb indices it saves us some bits on the wire and a comparison. We still have to regenerate the id.
docs/changelog/86647.yaml
Outdated
@@ -0,0 +1,5 @@ | |||
pr: 86647 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be mentioned here? I don't think this changes anything with the tsdb feature flag in place? If so then we should label this PR also as non-issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silly generated thing....
run elasticsearch-ci/packaging-tests-windows-sample |
This teaches reindex the smallest thing that it needs to know about
tsdb:
_id
is automatically generated. Armed with that knowledgereindex now doesn't attempt to copy the
_id
when writing to a tsdbindex.
Important: If the index doesn't yet exist it will assume that the
index will be created in
standard
mode. We can detect what mode itshould be created with in a follow up change.