Validating mappings when simulate ingest is called#106440
Validating mappings when simulate ingest is called#106440masseyke wants to merge 36 commits intoelastic:mainfrom
Conversation
|
Hi @masseyke, I've created a changelog YAML for you. |
henningandersen
left a comment
There was a problem hiding this comment.
I took a quick look. I am not a fan of the isSimulated flag. I wonder if we can try an alternative approach at least where we build a specific simulateIndex API instead? That goes both for the transport layer and the engine/index-shard layer.
I left a couple examples of problems. I am sure you could fix those too - but I'd be worried about the amount of ifs and us not catching some that need to be caught. The simulate action is a read-only action, whereas the bulk action is a write one, I think we have to treat them quite separately.
| @@ -1250,7 +1249,7 @@ public IndexResult index(Index index) throws IOException { | |||
| ); | |||
| } | |||
| localCheckpointTracker.markSeqNoAsProcessed(indexResult.getSeqNo()); | |||
There was a problem hiding this comment.
This looks like it should also not be done?
There was a problem hiding this comment.
You're right! I missed that one.
| ActionListener.wrap(v -> executor.execute(this), this::onRejection), | ||
| documentParsingProvider | ||
| documentParsingProvider, | ||
| request.isSimulated() |
There was a problem hiding this comment.
Not really for this line, but I wonder what would happen if a simulation failed to be replicated? I could imagine us failing the shard, which would be a pity?
There was a problem hiding this comment.
What do you mean by "failing the shard"? The only consequence would be that the call to simulate would fail, right (which might even be desirable, because that is what would happen if you were to attempt to actually index data)? Or are there worse consequences that I am not aware of (which is entirely possible since I'm new to this part of the codebase)?
There was a problem hiding this comment.
I've changed it to not run simulation in a TransportWriteRequest, while attempting to still reuse as much code as possible. Simulation now goes through TransportSimulateBulkShardAction, which is an ordinary TransportAction that calls the dispatchedShardOperationOnPrimary method on TransportShardBulkAction.
This reverts commit f739714.
…to make it more easily compatible with TransportShardBulkAction
|
Closed in favor of #110606 |
This adds functionality to the simulate ingest API (#101409). If the index exists when the ingest simulate API is called that the transformed documents would be indexed into if this were not a simulation, then it now reports any mapping validations that would occur. For example, if we have an index named
test-indexwith strict mappings and a single property namedfoo, then:would result in something like: