Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Indexer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Indexer
Commits
3abb9565
Commit
3abb9565
authored
2 years ago
by
Zhibin Mai
Browse files
Options
Downloads
Patches
Plain Diff
Ensure that createIndexAlias won't affect the creation of index
parent
2708ec8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!468
Create index alias when index is created
Pipeline
#164492
canceled
2 years ago
Stage: review
Stage: build
Stage: coverage
Stage: containerize
Stage: scan
Stage: deploy
Stage: integration
Changes
1
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexer-core/src/main/java/org/opengroup/osdu/indexer/service/IndicesServiceImpl.java
+16
-8
16 additions, 8 deletions
...rg/opengroup/osdu/indexer/service/IndicesServiceImpl.java
with
16 additions
and
8 deletions
indexer-core/src/main/java/org/opengroup/osdu/indexer/service/IndicesServiceImpl.java
+
16
−
8
View file @
3abb9565
...
...
@@ -52,10 +52,7 @@ import org.springframework.web.context.annotation.RequestScope;
import
java.io.IOException
;
import
java.lang.reflect.Type
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.*
;
@Service
@RequestScope
...
...
@@ -309,9 +306,16 @@ public class IndicesServiceImpl implements IndicesService {
private
void
createIndexAlias
(
RestHighLevelClient
client
,
String
index
)
{
String
kind
=
this
.
elasticIndexNameResolver
.
getKindFromIndexName
(
index
);
String
kindWithMajorVersion
=
getKindWithMajorVersion
(
kind
);
if
(!
elasticIndexNameResolver
.
isIndexAliasSupported
(
kind
))
return
;
try
{
for
(
String
kd
:
Arrays
.
asList
(
kind
,
kindWithMajorVersion
))
{
List
<
String
>
kinds
=
new
ArrayList
<>();
kinds
.
add
(
kind
);
if
(
getKindWithMajorVersion
(
kind
)
!=
null
)
{
kinds
.
add
(
getKindWithMajorVersion
(
kind
));
}
for
(
String
kd
:
kinds
)
{
index
=
elasticIndexNameResolver
.
getIndexNameFromKind
(
kd
);
String
alias
=
elasticIndexNameResolver
.
getIndexAliasFromKind
(
kd
);
IndicesAliasesRequest
addRequest
=
new
IndicesAliasesRequest
();
...
...
@@ -335,7 +339,11 @@ public class IndicesServiceImpl implements IndicesService {
// If kind is common:welldb:wellbore:1.2.0, then kind with major version is common:welldb:wellbore:1.*.*
int
idx
=
kind
.
lastIndexOf
(
":"
);
String
version
=
kind
.
substring
(
idx
+
1
);
String
majorVersion
=
version
.
substring
(
0
,
version
.
indexOf
(
"."
));
return
String
.
format
(
"%s:%s.*.*"
,
kind
.
substring
(
0
,
idx
),
majorVersion
);
if
(
version
.
indexOf
(
"."
)
>
0
)
{
String
kindWithoutVersion
=
kind
.
substring
(
0
,
idx
);
String
majorVersion
=
version
.
substring
(
0
,
version
.
indexOf
(
"."
));
return
String
.
format
(
"%s:%s.*.*"
,
kindWithoutVersion
,
majorVersion
);
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
Zhibin Mai
@zmai
mentioned in commit
e12c5277
·
2 years ago
mentioned in commit
e12c5277
mentioned in commit e12c527709ec964b941cf7a37bf0e501a046653c
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment