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

TSDB: Test create_doc permission #86638

Merged
merged 2 commits into from
May 11, 2022

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented May 10, 2022

This adds a test for the create_doc and index permissions into tsdb
indices.

@nik9000 nik9000 added >test Issues or PRs that are addressing/adding tests :StorageEngine/TSDB You know, for Metrics v8.3.0 labels May 10, 2022
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 10, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

This adds a test for the `create_doc` and `index` permissions into tsdb
indices.
@sethmlarson sethmlarson added the Team:Clients Meta label for clients team label May 10, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/clients-team (Team:Clients)

Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding a test!

@nik9000
Copy link
Member Author

nik9000 commented May 10, 2022

@elasticmachine update branch

Copy link
Contributor

@tvernum tvernum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test LGTM, but I have a question.

index:
refresh: true
index: test
op_type: index
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious what happens without this?
I assume that AutoIdHandler will set the op_type to create and then TSDB will reject the request because a document with the (auto generated) id already exists.

Is that the intended semantics of the {ts-index}/_doc endpoint - if there's a possibility that there might be an existing doc for the same tsid, then you need to set the op_type or be prepared to handle a failure?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the AutoIdHandler will only set the op_type to create if no op_type has been specified. So it will overwrite a document?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. It's a bit weird to me, but that's what happens. Without this you get create and overwrites stop in their tracks. I think it's a good thing that this isn't index dependent, but it is weird. And for _bulk we don't see it because folks say create or index. It's a quirk that'll have to be documented for tsdb.

@nik9000 nik9000 merged commit 3a87440 into elastic:master May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Clients Meta label for clients team >test Issues or PRs that are addressing/adding tests v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants