File tree Expand file tree Collapse file tree
src/main/kotlin/org/opensearch/reportsscheduler/index Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,13 +68,15 @@ internal object ReportDefinitionsIndex {
6868 .mapping(indexMappingSource, XContentType .YAML )
6969 .settings(indexSettingsSource, XContentType .YAML )
7070 try {
71- val actionFuture = client.admin().indices().create(request)
72- val response = actionFuture.actionGet(PluginSettings .operationTimeoutMs)
73- if (response.isAcknowledged) {
74- log.info(" $LOG_PREFIX :Index $REPORT_DEFINITIONS_INDEX_NAME creation Acknowledged" )
75- } else {
76- Metrics .REPORT_DEFINITION_CREATE_SYSTEM_ERROR .counter.increment()
77- error(" $LOG_PREFIX :Index $REPORT_DEFINITIONS_INDEX_NAME creation not Acknowledged" )
71+ client.threadPool().threadContext.stashContext().use {
72+ val actionFuture = client.admin().indices().create(request)
73+ val response = actionFuture.actionGet(PluginSettings .operationTimeoutMs)
74+ if (response.isAcknowledged) {
75+ log.info(" $LOG_PREFIX :Index $REPORT_DEFINITIONS_INDEX_NAME creation Acknowledged" )
76+ } else {
77+ Metrics .REPORT_DEFINITION_CREATE_SYSTEM_ERROR .counter.increment()
78+ error(" $LOG_PREFIX :Index $REPORT_DEFINITIONS_INDEX_NAME creation not Acknowledged" )
79+ }
7880 }
7981 } catch (exception: ResourceAlreadyExistsException ) {
8082 log.warn(" message: ${exception.message} " )
Original file line number Diff line number Diff line change @@ -68,12 +68,14 @@ internal object ReportInstancesIndex {
6868 .mapping(indexMappingSource, XContentType .YAML )
6969 .settings(indexSettingsSource, XContentType .YAML )
7070 try {
71- val actionFuture = client.admin().indices().create(request)
72- val response = actionFuture.actionGet(PluginSettings .operationTimeoutMs)
73- if (response.isAcknowledged) {
74- log.info(" $LOG_PREFIX :Index $REPORT_INSTANCES_INDEX_NAME creation Acknowledged" )
75- } else {
76- error(" $LOG_PREFIX :Index $REPORT_INSTANCES_INDEX_NAME creation not Acknowledged" )
71+ client.threadPool().threadContext.stashContext().use {
72+ val actionFuture = client.admin().indices().create(request)
73+ val response = actionFuture.actionGet(PluginSettings .operationTimeoutMs)
74+ if (response.isAcknowledged) {
75+ log.info(" $LOG_PREFIX :Index $REPORT_INSTANCES_INDEX_NAME creation Acknowledged" )
76+ } else {
77+ error(" $LOG_PREFIX :Index $REPORT_INSTANCES_INDEX_NAME creation not Acknowledged" )
78+ }
7779 }
7880 } catch (exception: ResourceAlreadyExistsException ) {
7981 log.warn(" message: ${exception.message} " )
You can’t perform that action at this time.
0 commit comments