Skip to content

Commit

Permalink
ignore system index warning
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Aug 31, 2023
1 parent 6ccb180 commit 2f14a4b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.RestClient
import org.opensearch.client.WarningsHandler
import org.opensearch.client.WarningsHandler.PERMISSIVE
import org.opensearch.common.io.PathUtils
import org.opensearch.common.settings.Settings
import org.opensearch.commons.ConfigConstants
Expand Down Expand Up @@ -368,6 +369,9 @@ abstract class PluginRestTestCase : OpenSearchRestTestCase() {
protected fun getCurrentMappingsSchemaVersion(): Int {
val indexName = ".opensearch-notifications-config"
val getMappingRequest = Request(RestRequest.Method.GET.name, "$indexName/_mappings")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(PERMISSIVE)
getMappingRequest.options = options.build()
val response = executeRequest(getMappingRequest, RestStatus.OK.status, client())
val mappingsObject = response.get(indexName).asJsonObject.get("mappings").asJsonObject
return mappingsObject.get(NotificationConfigIndex._META)?.asJsonObject?.get(NotificationConfigIndex.SCHEMA_VERSION)?.asInt
Expand Down

0 comments on commit 2f14a4b

Please sign in to comment.