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

Alias index transform #1049

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

n-dohrmann
Copy link
Contributor

Issue #, if available:
#656

Description of changes:
Adding to createTargetIndex method in the TransformIndexer module - want to support using aliases for variable target indices on transform jobs.

CheckList:

  • [ x] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (5aeed27) 74.81% compared to head (7cf342a) 62.64%.

Files Patch % Lines
...arch/indexmanagement/transform/TransformIndexer.kt 0.00% 9 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #1049       +/-   ##
=============================================
- Coverage     74.81%   62.64%   -12.18%     
+ Complexity     2810     2339      -471     
=============================================
  Files           367      367               
  Lines         16518    16527        +9     
  Branches       2362     2366        +4     
=============================================
- Hits          12358    10353     -2005     
- Misses         2857     5020     +2163     
+ Partials       1303     1154      -149     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -63,6 +65,20 @@ class TransformIndexer(
throw TransformIndexException("Failed to create the target index")
}
}
val writeIndexMetadata = clusterService.state().metadata.indicesLookup[targetIndex]!!.writeIndex
Copy link
Member

Choose a reason for hiding this comment

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

This line should inside the below if block?

if (clusterService.state().metadata.hasAlias(targetIndex)) {
// return error if no write index with the alias
if (writeIndexMetadata == null) {
throw TransformIndexException("Target index alias has no write index")
Copy link
Member

Choose a reason for hiding this comment

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

target_index [$targetIndex] is an alias but doesn't have write index

Comment on lines 75 to 81
val putMappingReq = PutMappingRequest(writeIndexMetadata?.index?.name).source(targetFieldMappings)
val mapResp: AcknowledgedResponse = client.admin().indices().suspendUntil {
putMapping(putMappingReq)
}
if (!mapResp.isAcknowledged) {
logger.error("Target index mapping request failed")
}
Copy link
Member

Choose a reason for hiding this comment

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

Also move this inside to above if block?

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

Successfully merging this pull request may close these issues.

2 participants