[Rename] refactor modules/kibana. (#334)

Refactor the the module `modules/kibana` to

- rename package names`org.elasticsearch.kibana` to `org.opensearch.dashboards` in package names and references.
- rename other instances of Kibana to OpenSearchDashboards

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
This commit is contained in:
Rabi Panda 2021-03-18 13:15:29 -07:00 committed by Nick Knize
parent d99bbfe2f2
commit 3954c658dc
5 changed files with 96 additions and 96 deletions

View File

@ -18,12 +18,12 @@
*/ */
configure(subprojects.findAll { it.parent.path == project.path }) { configure(subprojects.findAll { it.parent.path == project.path }) {
group = 'org.elasticsearch.plugin' // for modules which publish client jars group = 'org.opensearch.plugin' // for modules which publish client jars
apply plugin: 'elasticsearch.testclusters' apply plugin: 'opensearch.testclusters'
apply plugin: 'elasticsearch.esplugin' apply plugin: 'opensearch.opensearchplugin'
esplugin { opensearchplugin {
// for local ES plugins, the name of the plugin is the same as the directory // for local OpenSearch plugins, the name of the plugin is the same as the directory
name project.name name project.name
} }

View File

@ -16,11 +16,11 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
apply plugin: 'elasticsearch.java-rest-test' apply plugin: 'opensearch.java-rest-test'
esplugin { esplugin {
description 'Plugin exposing APIs for Kibana system indices' description 'Plugin exposing APIs for OpenSearch Dashboards system indices'
classname 'org.elasticsearch.kibana.KibanaPlugin' classname 'org.opensearch.dashboards.OpenSearchDashboardsPlugin'
} }
dependencies { dependencies {

View File

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.kibana; package org.opensearch.dashboards;
import com.carrotsearch.randomizedtesting.annotations.Name; import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
@ -35,19 +35,19 @@ import java.util.Map;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class KibanaSystemIndexIT extends OpenSearchRestTestCase { public class OpenSearchDashboardsSystemIndexIT extends OpenSearchRestTestCase {
private final String indexName; private final String indexName;
public KibanaSystemIndexIT(@Name("indexName") String indexName) { public OpenSearchDashboardsSystemIndexIT(@Name("indexName") String indexName) {
this.indexName = indexName; this.indexName = indexName;
} }
@ParametersFactory @ParametersFactory
public static Iterable<Object[]> data() { public static Iterable<Object[]> data() {
return Arrays.asList( return Arrays.asList(
new Object[] { ".kibana" }, new Object[] { ".opensearch_dashboards" },
new Object[] { ".kibana_1" }, new Object[] { ".opensearch_dashboards_1" },
new Object[] { ".reporting-1" }, new Object[] { ".reporting-1" },
new Object[] { ".apm-agent-configuration" }, new Object[] { ".apm-agent-configuration" },
new Object[] { ".apm-custom-link" } new Object[] { ".apm-custom-link" }
@ -55,45 +55,45 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
} }
public void testCreateIndex() throws IOException { public void testCreateIndex() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName); Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
} }
public void testAliases() throws IOException { public void testAliases() throws IOException {
assumeFalse("In this test, .kibana is the alias name", ".kibana".equals(indexName)); assumeFalse("In this test, .opensearch_dashboards is the alias name", ".opensearch_dashboards".equals(indexName));
Request request = new Request("PUT", "/_kibana/" + indexName); Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
request = new Request("PUT", "/_kibana/" + indexName + "/_alias/.kibana"); request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_alias/.opensearch_dashboards");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
request = new Request("GET", "/_kibana/_aliases"); request = new Request("GET", "/_opensearch_dashboards/_aliases");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
assertThat(EntityUtils.toString(response.getEntity()), containsString(".kibana")); assertThat(EntityUtils.toString(response.getEntity()), containsString(".opensearch_dashboards"));
} }
public void testBulkToKibanaIndex() throws IOException { public void testBulkToOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n"); request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n");
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
} }
public void testRefresh() throws IOException { public void testRefresh() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n"); request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n");
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
request = new Request("GET", "/_kibana/" + indexName + "/_refresh"); request = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_refresh");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
Request getRequest = new Request("GET", "/_kibana/" + indexName + "/_doc/1"); Request getRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_doc/1");
Response getResponse = client().performRequest(getRequest); Response getResponse = client().performRequest(getRequest);
assertThat(getResponse.getStatusLine().getStatusCode(), is(200)); assertThat(getResponse.getStatusLine().getStatusCode(), is(200));
String responseBody = EntityUtils.toString(getResponse.getEntity()); String responseBody = EntityUtils.toString(getResponse.getEntity());
@ -101,15 +101,15 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
assertThat(responseBody, containsString("bar")); assertThat(responseBody, containsString("bar"));
} }
public void testGetFromKibanaIndex() throws IOException { public void testGetFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n"); request.setJsonEntity("{ \"index\" : { \"_index\" : \"" + indexName + "\", \"_id\" : \"1\" } }\n{ \"foo\" : \"bar\" }\n");
request.addParameter("refresh", "true"); request.addParameter("refresh", "true");
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
Request getRequest = new Request("GET", "/_kibana/" + indexName + "/_doc/1"); Request getRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_doc/1");
Response getResponse = client().performRequest(getRequest); Response getResponse = client().performRequest(getRequest);
assertThat(getResponse.getStatusLine().getStatusCode(), is(200)); assertThat(getResponse.getStatusLine().getStatusCode(), is(200));
String responseBody = EntityUtils.toString(getResponse.getEntity()); String responseBody = EntityUtils.toString(getResponse.getEntity());
@ -117,8 +117,8 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
assertThat(responseBody, containsString("bar")); assertThat(responseBody, containsString("bar"));
} }
public void testMultiGetFromKibanaIndex() throws IOException { public void testMultiGetFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity( request.setJsonEntity(
"{ \"index\" : { \"_index\" : \"" "{ \"index\" : { \"_index\" : \""
+ indexName + indexName
@ -132,7 +132,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
Request getRequest = new Request("GET", "/_kibana/_mget"); Request getRequest = new Request("GET", "/_opensearch_dashboards/_mget");
getRequest.setJsonEntity( getRequest.setJsonEntity(
"{ \"docs\" : [ { \"_index\" : \"" "{ \"docs\" : [ { \"_index\" : \""
+ indexName + indexName
@ -150,8 +150,8 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
assertThat(responseBody, containsString("tag")); assertThat(responseBody, containsString("tag"));
} }
public void testSearchFromKibanaIndex() throws IOException { public void testSearchFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity( request.setJsonEntity(
"{ \"index\" : { \"_index\" : \"" "{ \"index\" : { \"_index\" : \""
+ indexName + indexName
@ -165,7 +165,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
Request searchRequest = new Request("GET", "/_kibana/" + indexName + "/_search"); Request searchRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_search");
searchRequest.setJsonEntity("{ \"query\" : { \"match_all\" : {} } }\n"); searchRequest.setJsonEntity("{ \"query\" : { \"match_all\" : {} } }\n");
Response getResponse = client().performRequest(searchRequest); Response getResponse = client().performRequest(searchRequest);
assertThat(getResponse.getStatusLine().getStatusCode(), is(200)); assertThat(getResponse.getStatusLine().getStatusCode(), is(200));
@ -176,8 +176,8 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
assertThat(responseBody, containsString("tag")); assertThat(responseBody, containsString("tag"));
} }
public void testDeleteFromKibanaIndex() throws IOException { public void testDeleteFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity( request.setJsonEntity(
"{ \"index\" : { \"_index\" : \"" "{ \"index\" : { \"_index\" : \""
+ indexName + indexName
@ -191,13 +191,13 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
Request deleteRequest = new Request("DELETE", "/_kibana/" + indexName + "/_doc/1"); Request deleteRequest = new Request("DELETE", "/_opensearch_dashboards/" + indexName + "/_doc/1");
Response deleteResponse = client().performRequest(deleteRequest); Response deleteResponse = client().performRequest(deleteRequest);
assertThat(deleteResponse.getStatusLine().getStatusCode(), is(200)); assertThat(deleteResponse.getStatusLine().getStatusCode(), is(200));
} }
public void testDeleteByQueryFromKibanaIndex() throws IOException { public void testDeleteByQueryFromOpenSearchDashboardsIndex() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity( request.setJsonEntity(
"{ \"index\" : { \"_index\" : \"" "{ \"index\" : { \"_index\" : \""
+ indexName + indexName
@ -211,62 +211,62 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
Request dbqRequest = new Request("POST", "/_kibana/" + indexName + "/_delete_by_query"); Request dbqRequest = new Request("POST", "/_opensearch_dashboards/" + indexName + "/_delete_by_query");
dbqRequest.setJsonEntity("{ \"query\" : { \"match_all\" : {} } }\n"); dbqRequest.setJsonEntity("{ \"query\" : { \"match_all\" : {} } }\n");
Response dbqResponse = client().performRequest(dbqRequest); Response dbqResponse = client().performRequest(dbqRequest);
assertThat(dbqResponse.getStatusLine().getStatusCode(), is(200)); assertThat(dbqResponse.getStatusLine().getStatusCode(), is(200));
} }
public void testUpdateIndexSettings() throws IOException { public void testUpdateIndexSettings() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName); Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
request = new Request("PUT", "/_kibana/" + indexName + "/_settings"); request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_settings");
request.setJsonEntity("{ \"index.blocks.read_only\" : false }"); request.setJsonEntity("{ \"index.blocks.read_only\" : false }");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
} }
public void testGetIndex() throws IOException { public void testGetIndex() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName); Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName);
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
request = new Request("GET", "/_kibana/" + indexName); request = new Request("GET", "/_opensearch_dashboards/" + indexName);
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
assertThat(EntityUtils.toString(response.getEntity()), containsString(indexName)); assertThat(EntityUtils.toString(response.getEntity()), containsString(indexName));
} }
public void testIndexingAndUpdatingDocs() throws IOException { public void testIndexingAndUpdatingDocs() throws IOException {
Request request = new Request("PUT", "/_kibana/" + indexName + "/_doc/1"); Request request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_doc/1");
request.setJsonEntity("{ \"foo\" : \"bar\" }"); request.setJsonEntity("{ \"foo\" : \"bar\" }");
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(201)); assertThat(response.getStatusLine().getStatusCode(), is(201));
request = new Request("PUT", "/_kibana/" + indexName + "/_create/2"); request = new Request("PUT", "/_opensearch_dashboards/" + indexName + "/_create/2");
request.setJsonEntity("{ \"foo\" : \"bar\" }"); request.setJsonEntity("{ \"foo\" : \"bar\" }");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(201)); assertThat(response.getStatusLine().getStatusCode(), is(201));
request = new Request("POST", "/_kibana/" + indexName + "/_doc"); request = new Request("POST", "/_opensearch_dashboards/" + indexName + "/_doc");
request.setJsonEntity("{ \"foo\" : \"bar\" }"); request.setJsonEntity("{ \"foo\" : \"bar\" }");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(201)); assertThat(response.getStatusLine().getStatusCode(), is(201));
request = new Request("GET", "/_kibana/" + indexName + "/_refresh"); request = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_refresh");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
request = new Request("POST", "/_kibana/" + indexName + "/_update/1"); request = new Request("POST", "/_opensearch_dashboards/" + indexName + "/_update/1");
request.setJsonEntity("{ \"doc\" : { \"foo\" : \"baz\" } }"); request.setJsonEntity("{ \"doc\" : { \"foo\" : \"baz\" } }");
response = client().performRequest(request); response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
} }
public void testScrollingDocs() throws IOException { public void testScrollingDocs() throws IOException {
Request request = new Request("POST", "/_kibana/_bulk"); Request request = new Request("POST", "/_opensearch_dashboards/_bulk");
request.setJsonEntity( request.setJsonEntity(
"{ \"index\" : { \"_index\" : \"" "{ \"index\" : { \"_index\" : \""
+ indexName + indexName
@ -282,7 +282,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
Response response = client().performRequest(request); Response response = client().performRequest(request);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));
Request searchRequest = new Request("GET", "/_kibana/" + indexName + "/_search"); Request searchRequest = new Request("GET", "/_opensearch_dashboards/" + indexName + "/_search");
searchRequest.setJsonEntity("{ \"size\" : 1,\n\"query\" : { \"match_all\" : {} } }\n"); searchRequest.setJsonEntity("{ \"size\" : 1,\n\"query\" : { \"match_all\" : {} } }\n");
searchRequest.addParameter("scroll", "1m"); searchRequest.addParameter("scroll", "1m");
response = client().performRequest(searchRequest); response = client().performRequest(searchRequest);
@ -291,7 +291,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
assertNotNull(map.get("_scroll_id")); assertNotNull(map.get("_scroll_id"));
String scrollId = (String) map.get("_scroll_id"); String scrollId = (String) map.get("_scroll_id");
Request scrollRequest = new Request("POST", "/_kibana/_search/scroll"); Request scrollRequest = new Request("POST", "/_opensearch_dashboards/_search/scroll");
scrollRequest.addParameter("scroll_id", scrollId); scrollRequest.addParameter("scroll_id", scrollId);
scrollRequest.addParameter("scroll", "1m"); scrollRequest.addParameter("scroll", "1m");
response = client().performRequest(scrollRequest); response = client().performRequest(scrollRequest);
@ -300,7 +300,7 @@ public class KibanaSystemIndexIT extends OpenSearchRestTestCase {
assertNotNull(map.get("_scroll_id")); assertNotNull(map.get("_scroll_id"));
scrollId = (String) map.get("_scroll_id"); scrollId = (String) map.get("_scroll_id");
Request clearScrollRequest = new Request("DELETE", "/_kibana/_search/scroll"); Request clearScrollRequest = new Request("DELETE", "/_opensearch_dashboards/_search/scroll");
clearScrollRequest.addParameter("scroll_id", scrollId); clearScrollRequest.addParameter("scroll_id", scrollId);
response = client().performRequest(clearScrollRequest); response = client().performRequest(clearScrollRequest);
assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(response.getStatusLine().getStatusCode(), is(200));

View File

@ -7,7 +7,7 @@
* not use this file except in compliance with the License. * not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.kibana; package org.opensearch.dashboards;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.node.DiscoveryNodes;
@ -28,7 +28,7 @@ import org.opensearch.common.settings.Setting.Property;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.opensearch.common.settings.SettingsFilter; import org.opensearch.common.settings.SettingsFilter;
import org.opensearch.index.reindex.RestDeleteByQueryAction; import org.opensearch.index.reindex.RestDeleteByQueryAction;
import org.elasticsearch.indices.SystemIndexDescriptor; import org.opensearch.indices.SystemIndexDescriptor;
import org.opensearch.plugins.Plugin; import org.opensearch.plugins.Plugin;
import org.opensearch.plugins.SystemIndexPlugin; import org.opensearch.plugins.SystemIndexPlugin;
import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BaseRestHandler;
@ -62,11 +62,11 @@ import java.util.stream.Collectors;
import static java.util.Collections.unmodifiableList; import static java.util.Collections.unmodifiableList;
public class KibanaPlugin extends Plugin implements SystemIndexPlugin { public class OpenSearchDashboardsPlugin extends Plugin implements SystemIndexPlugin {
public static final Setting<List<String>> KIBANA_INDEX_NAMES_SETTING = Setting.listSetting( public static final Setting<List<String>> OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING = Setting.listSetting(
"kibana.system_indices", "opensearch_dashboards.system_indices",
unmodifiableList(Arrays.asList(".kibana", ".kibana_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")), unmodifiableList(Arrays.asList(".opensearch_dashboards", ".opensearch_dashboards_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")),
Function.identity(), Function.identity(),
Property.NodeScope Property.NodeScope
); );
@ -74,9 +74,9 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
@Override @Override
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) { public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) {
return unmodifiableList( return unmodifiableList(
KIBANA_INDEX_NAMES_SETTING.get(settings) OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING.get(settings)
.stream() .stream()
.map(pattern -> new SystemIndexDescriptor(pattern, "System index used by kibana")) .map(pattern -> new SystemIndexDescriptor(pattern, "System index used by OpenSearch Dashboards"))
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
} }
@ -91,35 +91,35 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
IndexNameExpressionResolver indexNameExpressionResolver, IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<DiscoveryNodes> nodesInCluster Supplier<DiscoveryNodes> nodesInCluster
) { ) {
// TODO need to figure out what subset of system indices Kibana should have access to via these APIs // TODO need to figure out what subset of system indices OpenSearch Dashboards should have access to via these APIs
return unmodifiableList( return unmodifiableList(
Arrays.asList( Arrays.asList(
// Based on https://github.com/elastic/kibana/issues/49764 // Based on https://github.com/elastic/kibana/issues/49764
// apis needed to perform migrations... ideally these will go away // apis needed to perform migrations... ideally these will go away
new KibanaWrappedRestHandler(new RestCreateIndexAction()), new OpenSearchDashboardsWrappedRestHandler(new RestCreateIndexAction()),
new KibanaWrappedRestHandler(new RestGetAliasesAction()), new OpenSearchDashboardsWrappedRestHandler(new RestGetAliasesAction()),
new KibanaWrappedRestHandler(new RestIndexPutAliasAction()), new OpenSearchDashboardsWrappedRestHandler(new RestIndexPutAliasAction()),
new KibanaWrappedRestHandler(new RestRefreshAction()), new OpenSearchDashboardsWrappedRestHandler(new RestRefreshAction()),
// apis needed to access saved objects // apis needed to access saved objects
new KibanaWrappedRestHandler(new RestGetAction()), new OpenSearchDashboardsWrappedRestHandler(new RestGetAction()),
new KibanaWrappedRestHandler(new RestMultiGetAction(settings)), new OpenSearchDashboardsWrappedRestHandler(new RestMultiGetAction(settings)),
new KibanaWrappedRestHandler(new RestSearchAction()), new OpenSearchDashboardsWrappedRestHandler(new RestSearchAction()),
new KibanaWrappedRestHandler(new RestBulkAction(settings)), new OpenSearchDashboardsWrappedRestHandler(new RestBulkAction(settings)),
new KibanaWrappedRestHandler(new RestDeleteAction()), new OpenSearchDashboardsWrappedRestHandler(new RestDeleteAction()),
new KibanaWrappedRestHandler(new RestDeleteByQueryAction()), new OpenSearchDashboardsWrappedRestHandler(new RestDeleteByQueryAction()),
// api used for testing // api used for testing
new KibanaWrappedRestHandler(new RestUpdateSettingsAction()), new OpenSearchDashboardsWrappedRestHandler(new RestUpdateSettingsAction()),
// apis used specifically by reporting // apis used specifically by reporting
new KibanaWrappedRestHandler(new RestGetIndicesAction()), new OpenSearchDashboardsWrappedRestHandler(new RestGetIndicesAction()),
new KibanaWrappedRestHandler(new RestIndexAction()), new OpenSearchDashboardsWrappedRestHandler(new RestIndexAction()),
new KibanaWrappedRestHandler(new CreateHandler()), new OpenSearchDashboardsWrappedRestHandler(new CreateHandler()),
new KibanaWrappedRestHandler(new AutoIdHandler(nodesInCluster)), new OpenSearchDashboardsWrappedRestHandler(new AutoIdHandler(nodesInCluster)),
new KibanaWrappedRestHandler(new RestUpdateAction()), new OpenSearchDashboardsWrappedRestHandler(new RestUpdateAction()),
new KibanaWrappedRestHandler(new RestSearchScrollAction()), new OpenSearchDashboardsWrappedRestHandler(new RestSearchScrollAction()),
new KibanaWrappedRestHandler(new RestClearScrollAction()) new OpenSearchDashboardsWrappedRestHandler(new RestClearScrollAction())
) )
); );
@ -127,18 +127,18 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
@Override @Override
public List<Setting<?>> getSettings() { public List<Setting<?>> getSettings() {
return Collections.singletonList(KIBANA_INDEX_NAMES_SETTING); return Collections.singletonList(OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING);
} }
static class KibanaWrappedRestHandler extends BaseRestHandler.Wrapper { static class OpenSearchDashboardsWrappedRestHandler extends BaseRestHandler.Wrapper {
KibanaWrappedRestHandler(BaseRestHandler delegate) { OpenSearchDashboardsWrappedRestHandler(BaseRestHandler delegate) {
super(delegate); super(delegate);
} }
@Override @Override
public String getName() { public String getName() {
return "kibana_" + super.getName(); return "opensearch_dashboards_" + super.getName();
} }
@Override @Override
@ -150,7 +150,7 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {
public List<Route> routes() { public List<Route> routes() {
return unmodifiableList( return unmodifiableList(
super.routes().stream() super.routes().stream()
.map(route -> new Route(route.getMethod(), "/_kibana" + route.getPath())) .map(route -> new Route(route.getMethod(), "/_opensearch_dashboards" + route.getPath()))
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
} }

View File

@ -17,10 +17,10 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.kibana; package org.opensearch.dashboards;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.indices.SystemIndexDescriptor; import org.opensearch.indices.SystemIndexDescriptor;
import org.opensearch.test.OpenSearchTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.Arrays; import java.util.Arrays;
@ -31,27 +31,27 @@ import java.util.stream.Collectors;
import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class KibanaPluginTests extends OpenSearchTestCase { public class OpenSearchDashboardsPluginTests extends OpenSearchTestCase {
public void testKibanaIndexNames() { public void testOpenSearchDashboardsIndexNames() {
assertThat(new KibanaPlugin().getSettings(), contains(KibanaPlugin.KIBANA_INDEX_NAMES_SETTING)); assertThat(new OpenSearchDashboardsPlugin().getSettings(), contains(OpenSearchDashboardsPlugin.OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING));
assertThat( assertThat(
new KibanaPlugin().getSystemIndexDescriptors(Settings.EMPTY) new OpenSearchDashboardsPlugin().getSystemIndexDescriptors(Settings.EMPTY)
.stream() .stream()
.map(SystemIndexDescriptor::getIndexPattern) .map(SystemIndexDescriptor::getIndexPattern)
.collect(Collectors.toList()), .collect(Collectors.toList()),
contains(".kibana", ".kibana_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link") contains(".opensearch_dashboards", ".opensearch_dashboards_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")
); );
final List<String> names = Collections.unmodifiableList(Arrays.asList("." + randomAlphaOfLength(4), "." + randomAlphaOfLength(5))); final List<String> names = Collections.unmodifiableList(Arrays.asList("." + randomAlphaOfLength(4), "." + randomAlphaOfLength(5)));
final List<String> namesFromDescriptors = new KibanaPlugin().getSystemIndexDescriptors( final List<String> namesFromDescriptors = new OpenSearchDashboardsPlugin().getSystemIndexDescriptors(
Settings.builder().putList(KibanaPlugin.KIBANA_INDEX_NAMES_SETTING.getKey(), names).build() Settings.builder().putList(OpenSearchDashboardsPlugin.OPENSEARCH_DASHBOARDS_INDEX_NAMES_SETTING.getKey(), names).build()
).stream().map(SystemIndexDescriptor::getIndexPattern).collect(Collectors.toList()); ).stream().map(SystemIndexDescriptor::getIndexPattern).collect(Collectors.toList());
assertThat(namesFromDescriptors, is(names)); assertThat(namesFromDescriptors, is(names));
assertThat( assertThat(
new KibanaPlugin().getSystemIndexDescriptors(Settings.EMPTY) new OpenSearchDashboardsPlugin().getSystemIndexDescriptors(Settings.EMPTY)
.stream() .stream()
.anyMatch(systemIndexDescriptor -> systemIndexDescriptor.matchesIndexPattern(".kibana-event-log-7-1")), .anyMatch(systemIndexDescriptor -> systemIndexDescriptor.matchesIndexPattern(".opensearch_dashboards-event-log-7-1")),
is(false) is(false)
); );
} }