TSDB: Test create_doc permission#86638
Conversation
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
This adds a test for the `create_doc` and `index` permissions into tsdb indices.
|
Pinging @elastic/clients-team (Team:Clients) |
sethmlarson
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding a test!
|
@elasticmachine update branch |
tvernum
left a comment
There was a problem hiding this comment.
The test LGTM, but I have a question.
| index: | ||
| refresh: true | ||
| index: test | ||
| op_type: index |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This adds a test for the
create_docandindexpermissions into tsdbindices.