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

Rename more occurances of ElasticSearch to OpenSearch #22

Merged
merged 2 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class BaseBuildPlugin implements Plugin<Project> {
JavaHome esHadoopRuntimeJava = BuildParams.javaVersions.find { it.version == 8 }
if (esHadoopRuntimeJava == null) {
throw new GradleException(
'$JAVA8_HOME must be set to build ES-Hadoop. ' +
'$JAVA8_HOME must be set to build OpenSearch-Hadoop. ' +
"Note that if the variable was just set you might have to run `./gradlew --stop` for " +
"it to be picked up. See https://github.com/elastic/elasticsearch/issues/31399 details."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ public void configureJobConf(TableDesc tableDesc, JobConf jobConf) {
ClusterInfo clusterInfo = settings.getClusterInfoOrNull();
RestClient bootstrap = new RestClient(settings);
try {
// first get ES main action info if it's missing
// first get OpenSearch main action info if it's missing
if (clusterInfo == null) {
clusterInfo = bootstrap.mainInfo();
}
// Add the token to the job
TokenUtil.addTokenForJobConf(bootstrap, clusterInfo.getClusterName(), user, jobConf);
} catch (OpenSearchHadoopException ex) {
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect ES version - "
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect OpenSearch version - "
+ "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting "
+ "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.OPENSEARCH_NODES_WAN_ONLY), ex);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import org.opensearch.hadoop.cfg.Settings;
import org.opensearch.hadoop.rest.Transport;
import org.elasticsearch.hadoop.rest.pooling.TransportPool;
import org.opensearch.hadoop.security.SecureSettings;
import org.opensearch.hadoop.util.SettingsUtils;
import org.opensearch.hadoop.util.TestSettings;
Expand Down
12 changes: 6 additions & 6 deletions mr/src/main/java/org/opensearch/hadoop/cli/Keytool.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ public static int execute(Prompt console, String[] args) {
private static final String TBLFRMT = "%-15s%-19s%n";

private static void printUsage(Prompt prompt) {
prompt.println("A tool for managing settings stored in an ES-Hadoop keystore");
prompt.println("A tool for managing settings stored in an OpenSearch-Hadoop keystore");
prompt.println();
prompt.println("Commands");
prompt.println("--------");
prompt.println(Command.CREATE.getText() + " - Creates a new elasticsearch keystore");
prompt.println(Command.CREATE.getText() + " - Creates a new opensearch keystore");
prompt.println(Command.LIST.getText() + " - List entries in the keystore");
prompt.println(Command.ADD.getText() + " - Add a setting to the keystore");
prompt.println(Command.REMOVE.getText() + " - Remove a setting from the keystore");
Expand Down Expand Up @@ -180,7 +180,7 @@ public int run(String arg, boolean stdin, boolean force) throws IOException {
switch (command) {
case CREATE:
if (ksExists()) {
boolean proceed = promptYesNo("An es-hadoop keystore already exists. Overwrite? [y/N]");
boolean proceed = promptYesNo("An opensearch-hadoop keystore already exists. Overwrite? [y/N]");
if (proceed == false) {
prompt.println("Exiting without creating keystore");
return 0;
Expand All @@ -192,7 +192,7 @@ public int run(String arg, boolean stdin, boolean force) throws IOException {
return 0;
case LIST:
if (!ksExists()) {
prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
prompt.printf("ERROR: OpenSearch-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
return 5;
}
inputStream = openRead();
Expand All @@ -203,7 +203,7 @@ public int run(String arg, boolean stdin, boolean force) throws IOException {
return 0;
case ADD:
if (!ksExists()) {
prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
prompt.printf("ERROR: OpenSearch-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
return 5;
}
inputStream = openRead();
Expand All @@ -228,7 +228,7 @@ public int run(String arg, boolean stdin, boolean force) throws IOException {
return 0;
case REMOVE:
if (!ksExists()) {
prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
prompt.printf("ERROR: OpenSearch-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
return 5;
}
inputStream = openRead();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class AbstractHandlerLoader<E extends ErrorHandler> implements S
public enum NamedHandlers {
FAIL("fail"),
LOG("log"),
ES("es");
OPENSEARCH("opensearch");

private final String name;

Expand Down Expand Up @@ -90,8 +90,8 @@ public List<E> loadHandlers() {
failureHandlerAdded = true;
} else if (handlerName.equals(NamedHandlers.LOG.name)) {
handler = loadBuiltInHandler(NamedHandlers.LOG);
} else if (handlerName.equals(NamedHandlers.ES.name)) {
handler = loadBuiltInHandler(NamedHandlers.ES);
} else if (handlerName.equals(NamedHandlers.OPENSEARCH.name)) {
handler = loadBuiltInHandler(NamedHandlers.OPENSEARCH);
} else {
String handlerClassName = settings.getProperty(handlerPropertyPrefix + "." + handlerName);
handler = ObjectUtils.instantiate(handlerClassName, AbstractHandlerLoader.class.getClassLoader());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ public void init(Properties properties) {
this.clientSettings = handlerSettings.getSettingsView(CONF_CLIENT_CONF);

// Ensure we have a write resource to use
Assert.hasText(clientSettings.getResourceWrite(), "Could not locate write resource for ES error handler.");
Assert.hasText(clientSettings.getResourceWrite(), "Could not locate write resource for OpenSearch error handler.");

if (inheritRoot) {
LOG.info("Elasticsearch Error Handler inheriting root configuration");
LOG.info("OpenSearch Error Handler inheriting root configuration");
this.clientSettings = new CompositeSettings(Arrays.asList(clientSettings, rootSettings.excludeFilter("es.internal")));
} else {
LOG.info("Elasticsearch Error Handler proceeding without inheriting root configuration options as configured");
LOG.info("OpenSearch Error Handler proceeding without inheriting root configuration options as configured");
}

// Ensure no pattern in Index format, and extract the index to send errors to
Expand Down Expand Up @@ -229,7 +229,7 @@ public HandlerResult onError(I entry, C collector) throws Exception {
result = generateResult(returnError, errorReason, collector);
}
} catch (Exception e) {
LOG.error("Could not send error handling data to ES", e);
LOG.error("Could not send error handling data to OpenSearch", e);
result = generateResult(returnError, errorReason, collector);
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@
import org.opensearch.hadoop.util.ClusterInfo;

/**
* Utility functions for setting up Map Reduce Jobs to read and write from Elasticsearch.
* Utility functions for setting up Map Reduce Jobs to read and write from OpenSearch.
*
* @see EsInputFormat For reading from Elasticsearch
* @see EsOutputFormat For writing to Elasticsearch
* @see EsInputFormat For reading from OpenSearch
* @see EsOutputFormat For writing to OpenSearch
*/
public final class EsMapReduceUtil {
public final class OpenSearchMapReduceUtil {

private static final Log LOG = LogFactory.getLog(EsMapReduceUtil.class);
private static final Log LOG = LogFactory.getLog(OpenSearchMapReduceUtil.class);

private EsMapReduceUtil() { /* No instances */ }
private OpenSearchMapReduceUtil() { /* No instances */ }

/**
* Given the settings contained within a job object, retrieve an authentication token from either the currently logged in
* user or from the Elasticsearch cluster and add it to the job's credential set.
* @param job for collecting the settings to connect to Elasticsearch, as well as for storing the authentication token
* user or from the OpenSearch cluster and add it to the job's credential set.
* @param job for collecting the settings to connect to OpenSearch, as well as for storing the authentication token
*/
public static void initCredentials(Job job) {
Configuration configuration = job.getConfiguration();
Expand All @@ -72,7 +72,7 @@ public static void initCredentials(Job job) {
// Add the token to the job
TokenUtil.addTokenForJob(bootstrap, clusterInfo.getClusterName(), user, job);
} catch (OpenSearchHadoopException ex) {
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect ES version - "
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect OpenSearch version - "
+ "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting "
+ "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.OPENSEARCH_NODES_WAN_ONLY), ex);
} finally {
Expand Down Expand Up @@ -107,7 +107,7 @@ public static void initCredentials(JobConf jobConf) {
// Add the token to the job
TokenUtil.addTokenForJobConf(bootstrap, clusterInfo.getClusterName(), user, jobConf);
} catch (OpenSearchHadoopException ex) {
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect ES version - "
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect OpenSearch version - "
+ "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting "
+ "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.OPENSEARCH_NODES_WAN_ONLY), ex);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private enum ReservedHeaders {
* Content-Type HTTP Header should not be set by user as all requests made to Elasticsearch are done
* in JSON format, or the _bulk api compliant line delimited JSON.
*/
CONTENT_TYPE("Content-Type", "application/json", "ES-Hadoop communicates in JSON format only"),
CONTENT_TYPE("Content-Type", "application/json", "OpenSearch-Hadoop communicates in JSON format only"),
/*
* Elasticsearch also supports line-delimited JSON for '_bulk' operations which isn't
* official and has a few variations:
Expand All @@ -67,7 +67,7 @@ private enum ReservedHeaders {
* Accept HTTP Header should not be set by user as all responses from Elasticsearch are expected to be
* in JSON format.
*/
ACCEPT("Accept", "application/json", "ES-Hadoop communicates in JSON format only");
ACCEPT("Accept", "application/json", "OpenSearch-Hadoop communicates in JSON format only");

private static final Map<String, ReservedHeaders> NAME_MAP = new HashMap<String, ReservedHeaders>();
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ public static ClusterInfo discoverAndValidateClusterInfo(Settings settings, Log
mainInfo.getMajorVersion()));
}
} catch (OpenSearchHadoopException ex) {
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect ES version - "
+ "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting "
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect OpenSearch version - "
+ "typically this happens if the network/OpenSearch cluster is not accessible or when targeting "
+ "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.OPENSEARCH_NODES_WAN_ONLY), ex);
} finally {
bootstrap.close();
Expand Down Expand Up @@ -392,16 +392,16 @@ public static ClusterInfo discoverClusterInfo(Settings settings, Log log) {
try {
ClusterInfo mainInfo = bootstrap.mainInfo();
if (log.isDebugEnabled()) {
log.debug(String.format("Discovered Elasticsearch cluster [%s/%s], version [%s]",
log.debug(String.format("Discovered OpenSearch cluster [%s/%s], version [%s]",
mainInfo.getClusterName().getName(),
mainInfo.getClusterName().getUUID(),
mainInfo.getMajorVersion()));
}
settings.setInternalClusterInfo(mainInfo);
return mainInfo;
} catch (OpenSearchHadoopException ex) {
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect ES version - "
+ "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting "
throw new OpenSearchHadoopIllegalArgumentException(String.format("Cannot detect OpenSearch version - "
+ "typically this happens if the network/OpenSearch cluster is not accessible or when targeting "
+ "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.OPENSEARCH_NODES_WAN_ONLY), ex);
} finally {
bootstrap.close();
Expand Down
8 changes: 4 additions & 4 deletions mr/src/main/java/org/opensearch/hadoop/rest/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,12 @@ public ClusterInfo mainInfo() {
boolean verifyServer = (major.on(V_7_X) && major.parseMinorVersion(versionNumber) >= 14) || major.onOrAfter(V_8_X);
if (validElasticsearchHeader == false) {
if (verifyServer) {
throw new OpenSearchHadoopTransportException("Connected, but could not verify server is Elasticsearch. Response missing [" +
ELASTIC_PRODUCT_HEADER + "] header. Please check that you are connecting to an Elasticsearch instance, and " +
throw new OpenSearchHadoopTransportException("Connected, but could not verify server is OpenSearch. Response missing [" +
ELASTIC_PRODUCT_HEADER + "] header. Please check that you are connecting to an OpenSearch instance, and " +
"that any networking filters are preserving that header.");
} else {
LOG.warn("Could not verify server is Elasticsearch! ES-Hadoop will require server validation when connecting to an " +
"Elasticsearch cluster if that Elasticsearch cluster is v7.14 and up.");
LOG.warn("Could not verify server is OpenSearch! OpenSearch-Hadoop will require server validation when connecting to an " +
"OpenSearch cluster if that OpenSearch cluster is v7.14 and up.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected IBulkWriteErrorHandler loadBuiltInHandler(AbstractHandlerLoader.NamedH
case LOG:
genericHandler = DropAndLog.create(new BulkLogRenderer());
break;
case ES:
case OPENSEARCH:
genericHandler = ElasticsearchHandler.create(getSettings(), new BulkErrorEventConverter());
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected IDeserializationErrorHandler loadBuiltInHandler(AbstractHandlerLoader.
case LOG:
genericHandler = DropAndLog.create(new DeserializationLogRenderer());
break;
case ES:
case OPENSEARCH:
genericHandler = ElasticsearchHandler.create(getSettings(), new DeserializationEventConverter());
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected ISerializationErrorHandler loadBuiltInHandler(NamedHandlers handlerNam
case LOG:
genericHandler = DropAndLog.create(new SerializationLogRenderer());
break;
case ES:
case OPENSEARCH:
genericHandler = ElasticsearchHandler.create(getSettings(), new SerializationEventConverter());
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public boolean onOrBefore(OpenSearchMajorVersion version) {
return version.major >= major;
}

/** TODO !!!! CORRECT VERSIONING FOR OPENSEARCH COMPATIBILITY !!!! **/
public static OpenSearchMajorVersion parse(String version) {
if (version.startsWith("0.")) {
return new OpenSearchMajorVersion((byte) 0, version);
Expand All @@ -92,8 +93,8 @@ public static OpenSearchMajorVersion parse(String version) {
if (version.startsWith("8.")) {
return new OpenSearchMajorVersion((byte) 8, version);
}
throw new OpenSearchHadoopIllegalArgumentException("Unsupported/Unknown Elasticsearch version [" + version + "]." +
"Highest supported version is [" + LATEST.version + "]. You may need to upgrade ES-Hadoop.");
throw new OpenSearchHadoopIllegalArgumentException("Unsupported/Unknown OpenSearch version [" + version + "]." +
"Highest supported version is [" + LATEST.version + "]. You may need to upgrade OpenSearch-Hadoop.");
}

public int parseMinorVersion(String versionString) {
Expand Down
4 changes: 2 additions & 2 deletions mr/src/main/java/org/opensearch/hadoop/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public abstract class Version {
try {
res = Version.class.getClassLoader().getResources(target);
} catch (IOException ex) {
LogFactory.getLog(Version.class).warn("Cannot detect ES-Hadoop jar; it typically indicates a deployment issue...");
LogFactory.getLog(Version.class).warn("Cannot detect OpenSearch-Hadoop jar; it typically indicates a deployment issue...");
}

if (res != null) {
Expand Down Expand Up @@ -85,7 +85,7 @@ public abstract class Version {
// counting unique jar instances.
int foundJars = 0;
if (normalized.size() > 1) {
StringBuilder sb = new StringBuilder("Multiple ES-Hadoop versions detected in the classpath; please use only one\n");
StringBuilder sb = new StringBuilder("Multiple OpenSearch-Hadoop versions detected in the classpath; please use only one\n");
for (List<URL> pathURLs : normalized.values()) {
String path = pathURLs.get(0).toString();
if (path.contains("jar:")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void executeListFailUnknownArgument() {
assertHelpMessage(console.getOutput());
}

private static final String HELP = "A tool for managing settings stored in an ES-Hadoop keystore\n" +
private static final String HELP = "A tool for managing settings stored in an OpenSearch-Hadoop keystore\n" +
"\n" +
"Commands\n" +
"--------\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.opensearch.hadoop.rest;

import org.elasticsearch.hadoop.rest.ErrorUtils;
import org.opensearch.hadoop.util.BytesArray;
import org.junit.Test;

Expand Down