Skip to content

Commit

Permalink
[Rename] Replace more instances of Elasticsearch with OpenSearch. (op…
Browse files Browse the repository at this point in the history
…ensearch-project#432)

This commit replaces more replaceable instances of Elasticsearch with OpenSearch.

Signed-off-by: Rabi Panda <[email protected]>
  • Loading branch information
adnapibar authored and nknize committed Mar 22, 2021
1 parent 5ecb607 commit 8bba660
Show file tree
Hide file tree
Showing 110 changed files with 227 additions and 248 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ build-idea/
out/

# include shared intellij config
!.idea/scopes/x_pack.xml
!.idea/inspectionProfiles/Project_Default.xml
!.idea/runConfigurations/Debug_Elasticsearch.xml
!.idea/runConfigurations/Debug_OpenSearch.xml

# These files are generated in the main tree by IntelliJ
benchmarks/src/main/generated/*
Expand Down
3 changes: 0 additions & 3 deletions .idea/scopes/x_pack.xml

This file was deleted.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ tasks.register("verifyVersions") {
// Read the list from maven central.
// Fetch the metadata and parse the xml into Version instances because it's more straight forward here
// rather than bwcVersion ( VersionCollection ).
//TODO OpenSearch - Update the maven repo URL for OpenSearch when available.
new URL('https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
BuildParams.bwcVersions.compareToAuthoritative(
new XmlParser().parse(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void apply(Project project) {
/**
* Registers internal distribution resolutions.
* <p>
* Elasticsearch distributions are resolved as project dependencies either representing
* OpenSearch distributions are resolved as project dependencies either representing
* the current version pointing to a project either under `:distribution:archives` or :distribution:packages`.
* <p>
* BWC versions are resolved as project to projects under `:distribution:bwc`.
Expand Down
2 changes: 1 addition & 1 deletion client/client-benchmark-noop-api-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This plugin provides empty REST and transport endpoints for bulk indexing and se

### Build Instructions

Build the plugin with `gradle :client:client-benchmark-noop-api-plugin:assemble` from the Elasticsearch root project directory.
Build the plugin with `gradle :client:client-benchmark-noop-api-plugin:assemble` from the OpenSearch root project directory.

### Installation Instructions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected void assertEqualInstances(GetAliasesResponse expectedInstance, GetAlia
assertNull(newInstance.getException());
}

public void testFromXContentWithElasticsearchException() throws IOException {
public void testFromXContentWithOpenSearchException() throws IOException {
String xContent =
"{" +
" \"error\": {" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public void testSearchRequestHighlighting() throws IOException {
searchSourceBuilder.highlighter(highlightBuilder);
// end::search-request-highlighting
searchSourceBuilder.query(QueryBuilders.boolQuery()
.should(matchQuery("title", "Elasticsearch"))
.should(matchQuery("title", "OpenSearch"))
.should(matchQuery("user", "kimchy")));
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
Expand All @@ -473,7 +473,7 @@ public void testSearchRequestHighlighting() throws IOException {
HighlightField highlight = highlightFields.get("title");
Text[] fragments = highlight.fragments();
assertEquals(1, fragments.length);
assertThat(fragments[0].string(), containsString("<em>Elasticsearch</em>"));
assertThat(fragments[0].string(), containsString("<em>OpenSearch</em>"));
highlight = highlightFields.get("user");
fragments = highlight.fragments();
assertEquals(1, fragments.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ have been generated using the following openssl commands.
[source,shell]
-----------------------------------------------------------------------------------------------------------
openssl genrsa -out testRootCA.key 2048
openssl req -x509 -new -key testRootCA.key -days 1460 -subj "/CN=Elasticsearch Test Root CA/OU=elasticsearch/O=org" -out testRootCA.crt -config ./openssl_config.cnf
openssl req -x509 -new -key testRootCA.key -days 1460 -subj "/CN=OpenSearch Test Root CA/OU=opensearch/O=org" -out testRootCA.crt -config ./openssl_config.cnf
-----------------------------------------------------------------------------------------------------------

== Instructions on generating the Intermediate CA
Expand All @@ -20,7 +20,7 @@ The `testIntermediateCA.crt` CA certificate is "issued" by the `testRootCA.crt`.
[source,shell]
-----------------------------------------------------------------------------------------------------------
openssl genrsa -out testIntermediateCA.key 2048
openssl req -new -key testIntermediateCA.key -subj "/CN=Elasticsearch Test Intermediate CA/OU=Elasticsearch/O=org" -out testIntermediateCA.csr -config ./openssl_config.cnf
openssl req -new -key testIntermediateCA.key -subj "/CN=OpenSearch Test Intermediate CA/OU=OpenSearch/O=org" -out testIntermediateCA.csr -config ./openssl_config.cnf
openssl x509 -req -in testIntermediateCA.csr -CA testRootCA.crt -CAkey testRootCA.key -CAcreateserial -out testIntermediateCA.crt -days 1460 -sha256 -extensions v3_ca -extfile ./openssl_config.cnf
-----------------------------------------------------------------------------------------------------------

Expand All @@ -30,6 +30,6 @@ The `testClient.crt` end entity certificate is "issued" by the `testIntermediate
[source,shell]
-----------------------------------------------------------------------------------------------------------
openssl genrsa -out testClient.key 2048
openssl req -new -key testClient.key -subj "/CN=Elasticsearch Test Client/OU=Elasticsearch/O=org" -out testClient.csr -config ./openssl_config.cnf
openssl req -new -key testClient.key -subj "/CN=OpenSearch Test Client/OU=OpenSearch/O=org" -out testClient.csr -config ./openssl_config.cnf
openssl x509 -req -in testClient.csr -CA testIntermediateCA.crt -CAkey testIntermediateCA.key -CAcreateserial -out testClient.crt -days 1460 -sha256 -extensions usr_cert -extfile ./openssl_config.cnf
-----------------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ string_mask = nombstr
0.organizationName_default = org

organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = elasticsearch
organizationalUnitName_default = opensearch

commonName = Common Name (hostname, IP, or your name)
commonName_default = Elasticsearch Test Certificate
commonName_default = OpenSearch Test Certificate
commonName_max = 64

####################################################################
Expand Down
12 changes: 6 additions & 6 deletions client/rest/src/main/java/org/opensearch/client/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.TreeSet;

/**
* Metadata about an {@link HttpHost} running Elasticsearch.
* Metadata about an {@link HttpHost} running OpenSearch.
*/
public class Node {
/**
Expand All @@ -46,12 +46,12 @@ public class Node {
*/
private final String name;
/**
* Version of Elasticsearch that the node is running or {@code null}
* Version of OpenSearch that the node is running or {@code null}
* if we don't know the version.
*/
private final String version;
/**
* Roles that the Elasticsearch process on the host has or {@code null}
* Roles that the OpenSearch process on the host has or {@code null}
* if we don't know what roles the node has.
*/
private final Roles roles;
Expand Down Expand Up @@ -109,15 +109,15 @@ public String getName() {
}

/**
* Version of Elasticsearch that the node is running or {@code null}
* Version of OpenSearch that the node is running or {@code null}
* if we don't know the version.
*/
public String getVersion() {
return version;
}

/**
* Roles that the Elasticsearch process on the host has or {@code null}
* Roles that the OpenSearch process on the host has or {@code null}
* if we don't know what roles the node has.
*/
public Roles getRoles() {
Expand Down Expand Up @@ -173,7 +173,7 @@ public int hashCode() {
}

/**
* Role information about an Elasticsearch process.
* Role information about an OpenSearch process.
*/
public static final class Roles {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* any special handling if authentication fails.
* The default handler in Apache HTTP client mimics standard browser behaviour of clearing authentication
* credentials if it receives a 401 response from the server. While this can be useful for browser, it is
* rarely the desired behaviour with the Elasticsearch REST API.
* rarely the desired behaviour with the OpenSearch REST API.
* If the code using the REST client has configured credentials for the REST API, then we can and should
* assume that this is intentional, and those credentials represent the best possible authentication
* mechanism to the Elasticsearch node.
* mechanism to the OpenSearch node.
* If we receive a 401 status, a probably cause is that the authentication mechanism in place was unable
* to perform the requisite password checks (the node has not yet recovered its state, or an external
* authentication provider was unavailable).
Expand Down
14 changes: 7 additions & 7 deletions client/rest/src/main/java/org/opensearch/client/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import static java.util.Collections.unmodifiableMap;

/**
* HTTP Request to Elasticsearch.
* HTTP Request to OpenSearch.
*/
public final class Request {
private final String method;
Expand Down Expand Up @@ -122,26 +122,26 @@ public HttpEntity getEntity() {
}

/**
* Set the portion of an HTTP request to Elasticsearch that can be
* manipulated without changing Elasticsearch's behavior.
* Set the portion of an HTTP request to OpenSearch that can be
* manipulated without changing OpenSearch's behavior.
*/
public void setOptions(RequestOptions options) {
Objects.requireNonNull(options, "options cannot be null");
this.options = options;
}

/**
* Set the portion of an HTTP request to Elasticsearch that can be
* manipulated without changing Elasticsearch's behavior.
* Set the portion of an HTTP request to OpenSearch that can be
* manipulated without changing OpenSearch's behavior.
*/
public void setOptions(RequestOptions.Builder options) {
Objects.requireNonNull(options, "options cannot be null");
this.options = options.build();
}

/**
* Get the portion of an HTTP request to Elasticsearch that can be
* manipulated without changing Elasticsearch's behavior.
* Get the portion of an HTTP request to OpenSearch that can be
* manipulated without changing OpenSearch's behavior.
*/
public RequestOptions getOptions() {
return options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import java.util.Objects;

/**
* The portion of an HTTP request to Elasticsearch that can be
* manipulated without changing Elasticsearch's behavior.
* The portion of an HTTP request to OpenSearch that can be
* manipulated without changing OpenSearch's behavior.
*/
public final class RequestOptions {
/**
Expand Down
4 changes: 2 additions & 2 deletions client/rest/src/main/java/org/opensearch/client/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ public HttpEntity getEntity() {
/**
* Tests if a string matches the RFC 7234 specification for warning headers.
* This assumes that the warn code is always 299 and the warn agent is always
* Elasticsearch.
* OpenSearch.
*
* @param s the value of a warning header formatted according to RFC 7234
* @return {@code true} if the input string matches the specification
*/
private static boolean matchWarningHeaderPatternByPrefix(final String s) {
return s.startsWith("299 Elasticsearch-");
return s.startsWith("299 OpenSearch-");
}

/**
Expand Down
10 changes: 5 additions & 5 deletions client/rest/src/main/java/org/opensearch/client/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
import static java.util.Collections.singletonList;

/**
* Client that connects to an Elasticsearch cluster through HTTP.
* Client that connects to an OpenSearch cluster through HTTP.
* <p>
* Must be created using {@link RestClientBuilder}, which allows to set all the different options or just rely on defaults.
* The hosts that are part of the cluster need to be provided at creation time, but can also be replaced later
Expand Down Expand Up @@ -241,7 +241,7 @@ public boolean isRunning() {
}

/**
* Sends a request to the Elasticsearch cluster that the client points to.
* Sends a request to the OpenSearch cluster that the client points to.
* Blocks until the request is completed and returns its response or fails
* by throwing an exception. Selects a host out of the provided ones in a
* round-robin fashion. Failing hosts are marked dead and retried after a
Expand All @@ -260,10 +260,10 @@ public boolean isRunning() {
* {@link Exception#getCause()}.
*
* @param request the request to perform
* @return the response returned by Elasticsearch
* @return the response returned by OpenSearch
* @throws IOException in case of a problem or the connection was aborted
* @throws ClientProtocolException in case of an http protocol error
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
* @throws ResponseException in case OpenSearch responded with a status code that indicated an error
*/
public Response performRequest(Request request) throws IOException {
InternalRequest internalRequest = new InternalRequest(request);
Expand Down Expand Up @@ -335,7 +335,7 @@ private ResponseOrResponseException convertResponse(InternalRequest request, Nod
}

/**
* Sends a request to the Elasticsearch cluster that the client points to.
* Sends a request to the OpenSearch cluster that the client points to.
* The request is executed asynchronously and the provided
* {@link ResponseListener} gets notified upon request completion or
* failure. Selects a host out of the provided ones in a round-robin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public RestClientBuilder setRequestConfigCallback(RequestConfigCallback requestC
* For example, if this is set to "/my/path", then any client request will become <code>"/my/path/" + endpoint</code>.
* <p>
* In essence, every request's {@code endpoint} is prefixed by this {@code pathPrefix}. The path prefix is useful for when
* Elasticsearch is behind a proxy that provides a base path or a proxy that requires all paths to start with '/';
* OpenSearch is behind a proxy that provides a base path or a proxy that requires all paths to start with '/';
* it is not intended for other purposes and it should not be supplied in other scenarios.
*
* @throws NullPointerException if {@code pathPrefix} is {@code null}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ private void assertDeprecationWarnings(List<String> warningHeaderTexts, List<Str
*/
private static String formatWarningWithoutDate(String warningBody) {
final String hash = new String(new byte[40], StandardCharsets.UTF_8).replace('\0', 'e');
return "299 Elasticsearch-1.2.2-SNAPSHOT-" + hash + " \"" + warningBody + "\"";
return "299 OpenSearch-1.2.2-SNAPSHOT-" + hash + " \"" + warningBody + "\"";
}

private static String formatWarning(String warningBody) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@

/**
* Class responsible for sniffing the http hosts from opensearch through the nodes info api and returning them back.
* Compatible with elasticsearch 2.x+.
*/
public final class OpenSearchNodesSniffer implements NodesSniffer {

Expand Down
2 changes: 1 addition & 1 deletion distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ext.expansions = { Architecture architecture, DockerBase base, boolean local ->
sourceOpenSearch = """
RUN curl --retry 8 -S -L \\
--output /opt/opensearch.tar.gz \\
https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/$elasticsearch
<artifacts_link_placeholder>
"""
}

Expand Down
2 changes: 1 addition & 1 deletion distribution/docker/src/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN set -eux ; \\
RUN mkdir /usr/share/opensearch
WORKDIR /usr/share/opensearch
${source_elasticsearch}
${source_opensearch}
RUN tar zxf /opt/opensearch.tar.gz --strip-components=1
RUN sed -i -e 's/OPENSEARCH_DISTRIBUTION_TYPE=tar/OPENSEARCH_DISTRIBUTION_TYPE=docker/' /usr/share/opensearch/bin/opensearch-env
Expand Down
8 changes: 3 additions & 5 deletions distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,13 @@ apply plugin: 'nebula.ospackage-base'

// this is package indepdendent configuration
ospackage {
maintainer 'Elasticsearch Team <[email protected]>'
maintainer 'OpenSearch Team'
summary 'Distributed RESTful search engine built for the cloud'
packageDescription '''
Reference documentation can be found at
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
and the 'Elasticsearch: The Definitive Guide' book can be found at
https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
https://github.com/opensearch-project/OpenSearch
'''.stripIndent().trim()
url 'https://www.elastic.co/'
url 'https://github.com/opensearch-project/OpenSearch'

// signing setup
if (project.hasProperty('signing.password') && BuildParams.isSnapshotBuild() == false) {
Expand Down
6 changes: 0 additions & 6 deletions distribution/packages/src/deb/init.d/opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ if [ -f "$DEFAULT" ]; then
. "$DEFAULT"
fi

# ES_USER and ES_GROUP settings were removed
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
exit 1
fi

# Define other required variables
PID_FILE="$PID_DIR/$NAME.pid"
DAEMON=$OPENSEARCH_HOME/bin/opensearch
Expand Down
6 changes: 0 additions & 6 deletions distribution/packages/src/rpm/init.d/opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ if [ -f "$OPENSEARCH_ENV_FILE" ]; then
. "$OPENSEARCH_ENV_FILE"
fi

# ES_USER and ES_GROUP settings were removed
if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
echo "ES_USER and ES_GROUP settings are no longer supported. To run as a custom user/group use the archive distribution of Elasticsearch."
exit 1
fi

exec="$OPENSEARCH_HOME/bin/opensearch"
prog="opensearch"
pidfile="$PID_DIR/${prog}.pid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void main(final String[] args) {
if (JavaVersion.compare(JavaVersion.CURRENT, JavaVersion.JAVA_11) < 0) {
final String message = String.format(
Locale.ROOT,
"future versions of Elasticsearch will require Java 11; your Java version from [%s] does not meet this requirement",
"future versions of OpenSearch will require Java 11; your Java version from [%s] does not meet this requirement",
System.getProperty("java.home")
);
errPrintln(message);
Expand Down
Loading

0 comments on commit 8bba660

Please sign in to comment.