Skip to content

Commit

Permalink
Transition from old to new types
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Jul 9, 2024
1 parent eaa439c commit a750ff9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions RFS/src/main/java/com/rfs/models/IndexMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public interface IndexMetadata extends Index {
* See: https://github.com/elastic/elasticsearch/blob/v7.10.2/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java#L1475
* See: https://github.com/elastic/elasticsearch/blob/v6.8.23/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java#L1284
*/
public ObjectNode getAliases();
public JsonNode getAliases();
public String getId();
public ObjectNode getMappings();
public JsonNode getMappings();
public String getName();
public int getNumberOfShards();
public ObjectNode getSettings();
public JsonNode getSettings();
public IndexMetadata deepCopy();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.rfs.models.GlobalMetadata;
import com.rfs.models.IndexMetadata;
import com.rfs.version_os_2_11.GlobalMetadataData_OS_2_11;
import com.rfs.version_os_2_11.IndexMetadataData_OS_2_11;

import org.opensearch.migrations.transformation.TransformationRule;
import org.opensearch.migrations.transformation.entity.Index;
Expand Down Expand Up @@ -66,7 +67,7 @@ public GlobalMetadata transformGlobalMetadata(GlobalMetadata globalData) {
public IndexMetadata transformIndexMetadata(IndexMetadata index) {
var copy = index.deepCopy();
transformIndex(copy, IndexType.Concrete);
return copy;
return new IndexMetadataData_OS_2_11(copy.rawJson(), copy.getId(), copy.getName());
}

private void transformIndex(Index index, IndexType type) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.rfs.version_es_6_8;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.rfs.models.IndexMetadata;
Expand Down Expand Up @@ -31,7 +32,7 @@ public String getId() {
}

@Override
public ObjectNode getMappings() {
public JsonNode getMappings() {
if (mappings != null) {
return mappings;
}
Expand Down

0 comments on commit a750ff9

Please sign in to comment.