Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Jun 13, 2018
1 parent 7666d3e commit 8aeff95
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.license.License;
import org.elasticsearch.license.XPackInfoResponse;
import org.elasticsearch.transport.ActionNotFoundTransportException;
import org.elasticsearch.transport.RemoteClusterAware;
import org.elasticsearch.xpack.core.action.XPackInfoAction;
import org.elasticsearch.xpack.core.action.XPackInfoRequest;

Expand Down Expand Up @@ -140,7 +141,7 @@ static boolean licenseSupportsML(XPackInfoResponse.LicenseInfo licenseInfo) {
}

public static boolean isRemoteIndex(String index) {
return index.indexOf(':') != -1;
return index.indexOf(RemoteClusterAware.REMOTE_CLUSTER_INDEX_SEPARATOR) != -1;
}

public static boolean containsRemoteIndex(List<String> indices) {
Expand All @@ -153,7 +154,7 @@ public static boolean containsRemoteIndex(List<String> indices) {
* @return List of remote cluster indices
*/
public static List<String> remoteIndices(List<String> indices) {
return indices.stream().filter(index -> index.indexOf(':') != -1).collect(Collectors.toList());
return indices.stream().filter(MlRemoteLicenseChecker::isRemoteIndex).collect(Collectors.toList());
}

/**
Expand All @@ -165,7 +166,7 @@ public static List<String> remoteIndices(List<String> indices) {
public static List<String> remoteClusterNames(List<String> indices) {
return indices.stream()
.filter(MlRemoteLicenseChecker::isRemoteIndex)
.map(index -> index.substring(0, index.indexOf(':')))
.map(index -> index.substring(0, index.indexOf(RemoteClusterAware.REMOTE_CLUSTER_INDEX_SEPARATOR)))
.distinct()
.collect(Collectors.toList());
}
Expand Down

0 comments on commit 8aeff95

Please sign in to comment.